Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,18 @@ from PIL import Image
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
# Define the path to the CSV file in the current directory
|
| 7 |
-
csv_file_path = "descriptions.csv"
|
| 8 |
|
| 9 |
-
# Initialize an empty
|
| 10 |
-
data =
|
| 11 |
|
| 12 |
-
# Function to handle the user's input and store it in the
|
| 13 |
def describe_image(image, desc1, desc2, desc3):
|
| 14 |
global data
|
| 15 |
-
data
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
return None # Return None for no specific output
|
| 18 |
|
| 19 |
iface = gr.Interface(
|
|
@@ -35,4 +37,4 @@ iface = gr.Interface(
|
|
| 35 |
)
|
| 36 |
)
|
| 37 |
|
| 38 |
-
iface.launch(share=True)
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
# Define the path to the CSV file in the current directory
|
| 7 |
+
csv_file_path = "ImageCatalogizer/csv_data/descriptions.csv"
|
| 8 |
|
| 9 |
+
# Initialize an empty list to store the data
|
| 10 |
+
data = []
|
| 11 |
|
| 12 |
+
# Function to handle the user's input and store it in the list
|
| 13 |
def describe_image(image, desc1, desc2, desc3):
|
| 14 |
global data
|
| 15 |
+
data.append({"Image": image, "Description 1": desc1, "Description 2": desc2, "Description 3": desc3})
|
| 16 |
+
# Convert the list to a DataFrame
|
| 17 |
+
data_df = pd.DataFrame(data)
|
| 18 |
+
data_df.to_csv(csv_file_path, index=False) # Save the data to a CSV file in the current directory
|
| 19 |
return None # Return None for no specific output
|
| 20 |
|
| 21 |
iface = gr.Interface(
|
|
|
|
| 37 |
)
|
| 38 |
)
|
| 39 |
|
| 40 |
+
iface.launch(share=True)
|