Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,12 +194,12 @@ def gradio_predict(video,image, question):
|
|
| 194 |
|
| 195 |
|
| 196 |
def convert_and_save(data):
|
| 197 |
-
# Assuming 'data' is a dictionary
|
| 198 |
df = pd.DataFrame([data])
|
| 199 |
-
|
| 200 |
-
df.to_csv(
|
| 201 |
-
|
| 202 |
-
return ("annotations.csv",
|
| 203 |
|
| 204 |
css = """
|
| 205 |
#container{
|
|
@@ -235,7 +235,7 @@ with gr.Blocks(css = css) as app:
|
|
| 235 |
with gr.Column():
|
| 236 |
answer = gr.TextArea(label="Answer")
|
| 237 |
save_btn = gr.Button("Save as CSV")
|
| 238 |
-
download_link = gr.
|
| 239 |
|
| 240 |
# Make sure the inputs and outputs match in your click function
|
| 241 |
|
|
|
|
| 194 |
|
| 195 |
|
| 196 |
def convert_and_save(data):
|
| 197 |
+
# Assuming 'data' is a dictionary that we want to save as CSV
|
| 198 |
df = pd.DataFrame([data])
|
| 199 |
+
# Convert the DataFrame to a CSV string
|
| 200 |
+
csv_string = df.to_csv(index=False)
|
| 201 |
+
# Return a tuple with the filename and the CSV string
|
| 202 |
+
return ("annotations.csv", csv_string)
|
| 203 |
|
| 204 |
css = """
|
| 205 |
#container{
|
|
|
|
| 235 |
with gr.Column():
|
| 236 |
answer = gr.TextArea(label="Answer")
|
| 237 |
save_btn = gr.Button("Save as CSV")
|
| 238 |
+
download_link = gr.Dataframe(label="Download CSV")
|
| 239 |
|
| 240 |
# Make sure the inputs and outputs match in your click function
|
| 241 |
|