Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -88,6 +88,7 @@ title = "From Images to Textual Prompts: Zero-shot VQA with Frozen Large Languag
|
|
88 |
df_init = pd.DataFrame(columns=['Caption'])
|
89 |
raw_image = gr.Image(label='Input image', type="pil")
|
90 |
question = gr.Textbox(label="Input question", lines=1, interactive=True)
|
|
|
91 |
demo = gr.Blocks(title=title)
|
92 |
demo.encrypt = False
|
93 |
cap_df = gr.DataFrame(value=df_init, label="Caption dataframe", row_count=(0, "dynamic"), max_rows = 20, wrap=True, overflow_row_behaviour='paginate')
|
@@ -113,29 +114,24 @@ with demo:
|
|
113 |
label="Examples", inputs=[raw_image, question])
|
114 |
|
115 |
with gr.Row():
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
with gr.Row():
|
122 |
with gr.Column():
|
123 |
-
|
|
|
124 |
with gr.Column():
|
125 |
-
|
|
|
126 |
with gr.Row():
|
127 |
with gr.Column():
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
with gr.Row():
|
134 |
-
with gr.Column():
|
135 |
-
cap_df.render()
|
136 |
-
with gr.Row():
|
137 |
-
anws_btn = gr.Button("Answer")
|
138 |
-
text_output = gr.Textbox()
|
139 |
-
anws_btn.click(generate_answer, [raw_image, question], outputs=text_output)
|
140 |
|
141 |
demo.launch(debug=True)
|
|
|
88 |
df_init = pd.DataFrame(columns=['Caption'])
|
89 |
raw_image = gr.Image(label='Input image', type="pil")
|
90 |
question = gr.Textbox(label="Input question", lines=1, interactive=True)
|
91 |
+
text_output = gr.Textbox(label="Output Answer")
|
92 |
demo = gr.Blocks(title=title)
|
93 |
demo.encrypt = False
|
94 |
cap_df = gr.DataFrame(value=df_init, label="Caption dataframe", row_count=(0, "dynamic"), max_rows = 20, wrap=True, overflow_row_behaviour='paginate')
|
|
|
114 |
label="Examples", inputs=[raw_image, question])
|
115 |
|
116 |
with gr.Row():
|
117 |
+
with gr.Column():
|
118 |
+
raw_image.render()
|
119 |
+
with gr.Column():
|
120 |
+
question.render()
|
121 |
+
number_cap = gr.Number(precision=0, value=5, label="Selected number of caption you want to generate", interactive=True)
|
122 |
with gr.Row():
|
123 |
with gr.Column():
|
124 |
+
cap_btn = gr.Button("Generate caption")
|
125 |
+
cap_btn.click(generate_cap, [raw_image, question, number_cap], [cap_df])
|
126 |
with gr.Column():
|
127 |
+
anws_btn = gr.Button("Answer")
|
128 |
+
anws_btn.click(generate_answer, [raw_image, question], outputs=text_output)
|
129 |
with gr.Row():
|
130 |
with gr.Column():
|
131 |
+
# gradcam_btn = gr.Button("Generate Gradcam")
|
132 |
+
# gradcam_btn.click(gradcam_attention, [raw_image, question], outputs=[avg_gradcam])
|
133 |
+
cap_df.render()
|
134 |
+
with gr.Column():
|
135 |
+
text_output.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
demo.launch(debug=True)
|