Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -193,14 +193,22 @@ def gradio_predict(video,image, question):
|
|
| 193 |
return answer
|
| 194 |
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
def convert_and_save(data):
|
| 197 |
-
#
|
| 198 |
df = pd.DataFrame([data])
|
| 199 |
-
# Convert DataFrame to CSV
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
return ("annotations.csv", csv_buffer.getvalue())
|
| 204 |
|
| 205 |
css = """
|
| 206 |
#container{
|
|
|
|
| 193 |
return answer
|
| 194 |
|
| 195 |
|
| 196 |
+
# def convert_and_save(data):
|
| 197 |
+
# # Convert the answer dictionary to a DataFrame
|
| 198 |
+
# df = pd.DataFrame([data])
|
| 199 |
+
# # Convert DataFrame to CSV format
|
| 200 |
+
# csv_buffer = StringIO()
|
| 201 |
+
# df.to_csv(csv_buffer, index=False)
|
| 202 |
+
# # Gradio file components expect (filename, filecontents), hence the StringIO contents are read
|
| 203 |
+
# return ("annotations.csv", csv_buffer.getvalue())
|
| 204 |
+
|
| 205 |
def convert_and_save(data):
|
| 206 |
+
# Assuming 'data' is a dictionary that we want to save as CSV
|
| 207 |
df = pd.DataFrame([data])
|
| 208 |
+
# Convert the DataFrame to a CSV string
|
| 209 |
+
csv_string = df.to_csv(index=False)
|
| 210 |
+
# Return a tuple with the filename and the CSV string
|
| 211 |
+
return ("annotations.csv", csv_string)
|
|
|
|
| 212 |
|
| 213 |
css = """
|
| 214 |
#container{
|