Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
import google.generativeai as genai
|
3 |
-
from IPython.display import Markdown
|
4 |
-
import textwrap
|
5 |
-
|
6 |
-
def to_markdown(text):
|
7 |
-
if text is not None:
|
8 |
-
text = text.replace('•', ' *')
|
9 |
-
return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))
|
10 |
-
else:
|
11 |
-
return Markdown("No response received.")
|
12 |
|
13 |
token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
|
14 |
genai.configure(api_key=token)
|
@@ -18,10 +9,10 @@ model = genai.GenerativeModel(model_name="gemini-pro-vision")
|
|
18 |
|
19 |
# Fonction pour générer le contenu
|
20 |
def generate_content(image):
|
21 |
-
response = model.generate_content(["Write a short, engaging blog post based on this picture. It should include a description of the meal in the photo and talk about my journey meal prepping.", image]
|
22 |
print(response.text)
|
23 |
-
|
24 |
-
return
|
25 |
|
26 |
# Interface Gradio
|
27 |
iface = gr.Interface(fn=generate_content, inputs=gr.Image(type='pil'), outputs="text")
|
|
|
1 |
import gradio as gr
|
2 |
import google.generativeai as genai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
token = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
|
5 |
genai.configure(api_key=token)
|
|
|
9 |
|
10 |
# Fonction pour générer le contenu
|
11 |
def generate_content(image):
|
12 |
+
response = model.generate_content(["Write a short, engaging blog post based on this picture. It should include a description of the meal in the photo and talk about my journey meal prepping.", image])
|
13 |
print(response.text)
|
14 |
+
|
15 |
+
return response.resolve()
|
16 |
|
17 |
# Interface Gradio
|
18 |
iface = gr.Interface(fn=generate_content, inputs=gr.Image(type='pil'), outputs="text")
|