Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import PIL.Image
|
|
5 |
|
6 |
genai.configure(api_key="AIzaSyAj-b3sO_wUguMdpXWScxKzMHxb8C5cels")
|
7 |
|
8 |
-
def ImageChat(image):
|
9 |
|
10 |
# load model
|
11 |
model = genai.GenerativeModel("gemini-pro-vision")
|
@@ -17,18 +17,15 @@ def ImageChat(image):
|
|
17 |
else:
|
18 |
img = PIL.Image.open(image)
|
19 |
|
20 |
-
response = model.generate_content([
|
21 |
|
22 |
return response.text
|
23 |
|
24 |
|
25 |
app = gr.Interface(ImageChat,
|
26 |
-
inputs = gr.Image(),
|
27 |
outputs = gr.Text(),
|
28 |
-
title = "Image
|
29 |
theme = gr.themes.Soft())
|
30 |
|
31 |
-
|
32 |
app.launch()
|
33 |
-
|
34 |
-
|
|
|
5 |
|
6 |
genai.configure(api_key="AIzaSyAj-b3sO_wUguMdpXWScxKzMHxb8C5cels")
|
7 |
|
8 |
+
def ImageChat(image, prompt):
|
9 |
|
10 |
# load model
|
11 |
model = genai.GenerativeModel("gemini-pro-vision")
|
|
|
17 |
else:
|
18 |
img = PIL.Image.open(image)
|
19 |
|
20 |
+
response = model.generate_content([prompt, img])
|
21 |
|
22 |
return response.text
|
23 |
|
24 |
|
25 |
app = gr.Interface(ImageChat,
|
26 |
+
inputs = [gr.Image(), gr.Text()],
|
27 |
outputs = gr.Text(),
|
28 |
+
title = "Image Chat",
|
29 |
theme = gr.themes.Soft())
|
30 |
|
|
|
31 |
app.launch()
|
|
|
|