Spaces:
Sleeping
Sleeping
import gradio as gr | |
import google.generativeai as genai | |
token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko" | |
genai.configure(api_key=token) | |
# Chargez l'image | |
model = genai.GenerativeModel(model_name="gemini-pro-vision") | |
# Fonction pour générer le contenu | |
def generate_content(pro, image): | |
response = model.generate_content([pro, image]) | |
print(response.text) | |
resultat = response.text | |
return resultat | |
# Interface Gradio | |
iface = gr.Interface(fn=generate_content, inputs=[gr.Textbox(), gr.Image(type='pil')], outputs="text") | |
# Lancez l'interface Gradio | |
iface.launch(share=True) | |
# Ajoutez la sortie en Markdown | |
markdown = f"resultat: {resultat}" | |
# Utilisez Gradio Blocks pour afficher en Markdown | |
with gr.Blocks() as demo: | |
gr.Markdown(markdown) | |
demo.queue().launch() | |