bestroi commited on
Commit
f6200e9
·
1 Parent(s): f474bb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
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 DataFrame to store the data
10
- data = pd.DataFrame(columns=["Image", "Description 1", "Description 2", "Description 3"])
11
 
12
- # Function to handle the user's input and store it in the DataFrame
13
  def describe_image(image, desc1, desc2, desc3):
14
  global data
15
- data = data.append({"Image": image, "Description 1": desc1, "Description 2": desc2, "Description 3": desc3}, ignore_index=True)
16
- data.to_csv(csv_file_path, index=False) # Save the data to a CSV file in the current directory
 
 
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)