Spaces:
Build error
Build error
iamrobotbear
commited on
Commit
·
f51ad44
1
Parent(s):
e981e7f
trying to fix csv output
Browse files
app.py
CHANGED
@@ -82,6 +82,14 @@ def generate_caption(processor, model, image):
|
|
82 |
logging.info('Finished generate_caption')
|
83 |
return generated_caption
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
# Main function to perform image captioning and image-text matching
|
86 |
def process_images_and_statements(image):
|
87 |
logging.info('Starting process_images_and_statements')
|
|
|
82 |
logging.info('Finished generate_caption')
|
83 |
return generated_caption
|
84 |
|
85 |
+
|
86 |
+
# Function to save dataframe results to a CSV file for download
|
87 |
+
def save_dataframe_to_csv(df):
|
88 |
+
csv_buffer = io.StringIO()
|
89 |
+
df.to_csv(csv_buffer, index=False)
|
90 |
+
csv_string = csv_buffer.getvalue()
|
91 |
+
return csv_string.encode('utf-8') # Return the CSV contents as bytes
|
92 |
+
|
93 |
# Main function to perform image captioning and image-text matching
|
94 |
def process_images_and_statements(image):
|
95 |
logging.info('Starting process_images_and_statements')
|