Spaces:
Runtime error
Runtime error
howard-hou
commited on
Commit
·
ec6a8d2
1
Parent(s):
db59805
Update app.py
Browse files
app.py
CHANGED
@@ -111,12 +111,22 @@ def test(image, question):
|
|
111 |
for output in generate(input_text, image_ids):
|
112 |
yield output
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
-
demo
|
122 |
-
demo.launch(share=False
|
|
|
111 |
for output in generate(input_text, image_ids):
|
112 |
yield output
|
113 |
|
114 |
+
with gr.Blocks(title=title) as demo:
|
115 |
+
with gr.Row():
|
116 |
+
with gr.Column():
|
117 |
+
image = gr.Image(type='pil', label="Image")
|
118 |
+
with gr.Column():
|
119 |
+
prompt = gr.Textbox(lines=2, label="Prompt",
|
120 |
+
value="Assistant: Please upload an image and ask a question.")
|
121 |
+
with gr.Column():
|
122 |
+
with gr.Row():
|
123 |
+
submit = gr.Button("Submit", variant="primary")
|
124 |
+
clear = gr.Button("Clear", variant="secondary")
|
125 |
+
output = gr.Textbox(label="Output", lines=5)
|
126 |
+
data = gr.Dataset(components=[image, prompt], samples=examples, label="Examples", headers=["Image", "Prompt"])
|
127 |
+
submit.click(test, [image, prompt], [output])
|
128 |
+
clear.click(lambda: None, [], [output])
|
129 |
+
data.click(lambda x: x, [data], [image, prompt])
|
130 |
|
131 |
+
demo.queue(concurrency_count=1, max_size=10)
|
132 |
+
demo.launch(share=False)
|