import gradio as gr import google.generativeai as genai import os token=os.environ.get("TOKEN") genai.configure(api_key=token) # Chargez l'image model = genai.GenerativeModel(model_name="gemini-pro-vision") model_simple = genai.GenerativeModel(model_name="gemini-pro") e ="" # Fonction pour générer le contenu def generate_content(pro,image): global e if not image: response = model_simple.generate_content(pro) e = response.text else: response = model.generate_content([pro, image]) print(response.text) e = response.text return e markdown = r""" e """.format(e) # Interface Gradio iface = gr.Interface(fn=generate_content, inputs=[gr.Textbox(),gr.Image(type='pil')], outputs= gr.Markdown(markdown, latex_delimiters=[{ "left":"$$", "right":"$$", "display": True }])) iface.launch()