Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,9 +35,10 @@ def process_images(image_files):
|
|
| 35 |
captions.append((os.path.basename(image_file), caption))
|
| 36 |
except Exception as e:
|
| 37 |
print(f"Skipping file {image_file}: {e}")
|
| 38 |
-
|
| 39 |
-
return csv_file_path
|
| 40 |
|
|
|
|
| 41 |
def process_zip_files(zip_file_paths):
|
| 42 |
# Create a directory to extract images
|
| 43 |
extract_dir = 'extracted_images'
|
|
@@ -59,8 +60,8 @@ def process_zip_files(zip_file_paths):
|
|
| 59 |
captions.append((file, caption))
|
| 60 |
except Exception as e:
|
| 61 |
print(f"Skipping file {file}: {e}")
|
| 62 |
-
|
| 63 |
-
return csv_file_path
|
| 64 |
|
| 65 |
def save_captions_to_csv(captions, csv_file_path='image_captions.csv'):
|
| 66 |
with open(csv_file_path, mode='w', newline='') as file:
|
|
|
|
| 35 |
captions.append((os.path.basename(image_file), caption))
|
| 36 |
except Exception as e:
|
| 37 |
print(f"Skipping file {image_file}: {e}")
|
| 38 |
+
csv_file_path = save_captions_to_csv(captions, csv_file_path='zip_captions.csv')
|
| 39 |
+
return csv_file_path
|
| 40 |
|
| 41 |
+
|
| 42 |
def process_zip_files(zip_file_paths):
|
| 43 |
# Create a directory to extract images
|
| 44 |
extract_dir = 'extracted_images'
|
|
|
|
| 60 |
captions.append((file, caption))
|
| 61 |
except Exception as e:
|
| 62 |
print(f"Skipping file {file}: {e}")
|
| 63 |
+
csv_file_path = save_captions_to_csv(captions, csv_file_path='zip_captions.csv')
|
| 64 |
+
return csv_file_path
|
| 65 |
|
| 66 |
def save_captions_to_csv(captions, csv_file_path='image_captions.csv'):
|
| 67 |
with open(csv_file_path, mode='w', newline='') as file:
|