Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,7 +65,7 @@ def process_zip_files(zip_file_paths):
|
|
| 65 |
def save_captions_to_csv(captions, csv_file_path='image_captions.csv'):
|
| 66 |
with open(csv_file_path, mode='w', newline='') as file:
|
| 67 |
writer = csv.writer(file)
|
| 68 |
-
writer.writerow(['Image', 'Caption'])
|
| 69 |
writer.writerows(captions)
|
| 70 |
return csv_file_path
|
| 71 |
|
|
@@ -131,7 +131,7 @@ with demo:
|
|
| 131 |
output_image_file = gr.File(label="Download Image Captions")
|
| 132 |
combined_file = gr.File(label="Download Combined Captions")
|
| 133 |
|
| 134 |
-
add_files_btn = gr.Button("Add More Files")
|
| 135 |
generate_zip_captions_btn = gr.Button("Generate Zip Captions")
|
| 136 |
generate_image_captions_btn = gr.Button("Generate Image Captions")
|
| 137 |
combine_files_btn = gr.Button("Combine CSV Files")
|
|
@@ -146,4 +146,4 @@ with demo:
|
|
| 146 |
generate_image_captions_btn.click(fn=gr_process_images, inputs=image_files, outputs=output_image_file)
|
| 147 |
combine_files_btn.click(fn=combine_csv_files, inputs=[output_zip_file, output_image_file], outputs=combined_file)
|
| 148 |
|
| 149 |
-
demo.launch(share=True)
|
|
|
|
| 65 |
def save_captions_to_csv(captions, csv_file_path='image_captions.csv'):
|
| 66 |
with open(csv_file_path, mode='w', newline='') as file:
|
| 67 |
writer = csv.writer(file)
|
| 68 |
+
writer.writerow(['Image Name', 'Caption'])
|
| 69 |
writer.writerows(captions)
|
| 70 |
return csv_file_path
|
| 71 |
|
|
|
|
| 131 |
output_image_file = gr.File(label="Download Image Captions")
|
| 132 |
combined_file = gr.File(label="Download Combined Captions")
|
| 133 |
|
| 134 |
+
# add_files_btn = gr.Button("Add More Files")
|
| 135 |
generate_zip_captions_btn = gr.Button("Generate Zip Captions")
|
| 136 |
generate_image_captions_btn = gr.Button("Generate Image Captions")
|
| 137 |
combine_files_btn = gr.Button("Combine CSV Files")
|
|
|
|
| 146 |
generate_image_captions_btn.click(fn=gr_process_images, inputs=image_files, outputs=output_image_file)
|
| 147 |
combine_files_btn.click(fn=combine_csv_files, inputs=[output_zip_file, output_image_file], outputs=combined_file)
|
| 148 |
|
| 149 |
+
demo.launch(share=True)
|