Spaces:
Sleeping
Sleeping
File size: 756 Bytes
271a3d2 4b51045 24488cc 4b51045 6f1f950 24488cc 4b51045 6f1f950 24488cc 330cf60 e2b48fd 59d059f e871a25 24488cc 330cf60 5fedf9f 330cf60 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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)
e = response.text
return e
# Interface Gradio
iface = gr.Interface(fn=generate_content, inputs=[gr.Textbox(), gr.Image(type='pil')], outputs="text")
iface.launch(share=True)
# Markdown après l'interface Gradio
markdown = f"""
{e}
"""
with gr.Blocks() as demo:
gr.Markdown(markdown, latex_delimiters=[{"left": "$$", "right": "$$", "display": True}])
demo.queue().launch()
|