Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,21 +8,21 @@ genai.configure(api_key=token)
|
|
8 |
model = genai.GenerativeModel(model_name="gemini-pro-vision")
|
9 |
|
10 |
# Fonction pour générer le contenu
|
11 |
-
def generate_content(pro,
|
12 |
response = model.generate_content([pro, image])
|
13 |
print(response.text)
|
14 |
-
|
15 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Interface Gradio
|
18 |
-
iface = gr.Interface(fn=generate_content, inputs=[gr.Textbox(),
|
19 |
iface.launch(share=True)
|
20 |
-
|
21 |
-
# Markdown après l'interface Gradio
|
22 |
-
markdown = f"""
|
23 |
-
{e}
|
24 |
-
"""
|
25 |
-
|
26 |
-
with gr.Blocks() as demo:
|
27 |
-
gr.Markdown(markdown, latex_delimiters=[{"left": "$$", "right": "$$", "display": True}])
|
28 |
-
demo.queue().launch()
|
|
|
8 |
model = genai.GenerativeModel(model_name="gemini-pro-vision")
|
9 |
|
10 |
# Fonction pour générer le contenu
|
11 |
+
def generate_content(pro,image):
|
12 |
response = model.generate_content([pro, image])
|
13 |
print(response.text)
|
14 |
+
c = response.text # Utilisez la variable c au lieu de e
|
15 |
+
return c
|
16 |
+
|
17 |
+
# Fonction pour afficher le contenu en markdown
|
18 |
+
def display_markdown(content):
|
19 |
+
markdown = r"""
|
20 |
+
{}
|
21 |
+
""".format(content)
|
22 |
+
with gr.Blocks() as demo:
|
23 |
+
gr.Markdown(markdown, latex_delimiters=[{ "left": "$$", "right": "$$", "display": True }])
|
24 |
+
return demo
|
25 |
|
26 |
# Interface Gradio
|
27 |
+
iface = gr.Interface(fn=[generate_content, display_markdown], inputs=[gr.Textbox(),gr.Image(type='pil')], outputs=["text", "html"])
|
28 |
iface.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|