Spaces:
Build error
Build error
hubsnippetai
commited on
Commit
•
1a15f55
1
Parent(s):
5d289bc
Update app.py
Browse files
app.py
CHANGED
@@ -9,9 +9,9 @@ processor = AutoProcessor.from_pretrained("microsoft/kosmos-2-patch14-224")
|
|
9 |
|
10 |
# The original Kosmos-2 demo saves the image first then reload it. For some images, this will give slightly different image input and change the generation outputs.
|
11 |
|
12 |
-
prompt = "{question}"
|
13 |
|
14 |
-
def describe_image(image_path, question):
|
15 |
inputs = processor(text=question, images=image_path, return_tensors="pt")
|
16 |
|
17 |
generated_ids = model.generate(
|
@@ -34,7 +34,7 @@ def describe_image(image_path, question):
|
|
34 |
|
35 |
import gradio as gr
|
36 |
|
37 |
-
gr_app = gr.Interface(fn=describe_image, inputs=[gr.Image(label="Upload an image for description", type='pil'), "
|
38 |
outputs=[gr.Textbox(label="Image description")], title="App for image description")
|
39 |
|
40 |
if __name__ == "__main__":
|
|
|
9 |
|
10 |
# The original Kosmos-2 demo saves the image first then reload it. For some images, this will give slightly different image input and change the generation outputs.
|
11 |
|
12 |
+
#prompt = "{question}"
|
13 |
|
14 |
+
def describe_image(image_path, question : str):
|
15 |
inputs = processor(text=question, images=image_path, return_tensors="pt")
|
16 |
|
17 |
generated_ids = model.generate(
|
|
|
34 |
|
35 |
import gradio as gr
|
36 |
|
37 |
+
gr_app = gr.Interface(fn=describe_image, inputs=[gr.Image(label="Upload an image for description", type='pil'), gr.Textbox(label="Ask a question about the image")],
|
38 |
outputs=[gr.Textbox(label="Image description")], title="App for image description")
|
39 |
|
40 |
if __name__ == "__main__":
|