Spaces:
Paused
Paused
ManishThota
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -192,9 +192,10 @@ def gradio_predict(video,image, question):
|
|
192 |
|
193 |
return answer
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
198 |
|
199 |
css = """
|
200 |
#container{
|
@@ -230,7 +231,7 @@ with gr.Blocks(css = css) as app:
|
|
230 |
with gr.Column():
|
231 |
answer = gr.TextArea(label="Answer")
|
232 |
save_btn = gr.Button("Save as CSV")
|
233 |
-
|
234 |
|
235 |
# Make sure the inputs and outputs match in your click function
|
236 |
|
@@ -238,7 +239,7 @@ with gr.Blocks(css = css) as app:
|
|
238 |
btn.click(gradio_predict, inputs=[video,image, question], outputs=answer)
|
239 |
|
240 |
# Button to save the answer as CSV
|
241 |
-
save_btn.click(
|
242 |
|
243 |
|
244 |
gr.Examples(
|
|
|
192 |
|
193 |
return answer
|
194 |
|
195 |
+
def export_csv(d):
|
196 |
+
df = pd.Dataframe([d])
|
197 |
+
df.to_csv("output.csv")
|
198 |
+
return gr.File.update(value="output.csv", visible=True)
|
199 |
|
200 |
css = """
|
201 |
#container{
|
|
|
231 |
with gr.Column():
|
232 |
answer = gr.TextArea(label="Answer")
|
233 |
save_btn = gr.Button("Save as CSV")
|
234 |
+
csv = gr.File(interactive=False, visible=False)
|
235 |
|
236 |
# Make sure the inputs and outputs match in your click function
|
237 |
|
|
|
239 |
btn.click(gradio_predict, inputs=[video,image, question], outputs=answer)
|
240 |
|
241 |
# Button to save the answer as CSV
|
242 |
+
save_btn.click(export_csv, answer, csv)
|
243 |
|
244 |
|
245 |
gr.Examples(
|