mkaramb commited on
Commit
3851673
·
verified ·
1 Parent(s): c23414d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -55,11 +55,14 @@ def unzip_and_find_jpgs(file_path):
55
  def process_images(uploaded_file):
56
  # Reinitialize the DataFrame each time this function is called
57
  results_df = pd.DataFrame(columns=["Filename", "Extracted Text", "Translated Text"])
 
58
 
59
  file_path = uploaded_file.name # Gradio provides the file path through the .name attribute
 
60
 
61
  try:
62
  image_files = unzip_and_find_jpgs(file_path)
 
63
 
64
  if not image_files:
65
  return "No JPG files found in the zip."
@@ -72,6 +75,7 @@ def process_images(uploaded_file):
72
  "Translated Text": translated_text
73
  }])
74
  results_df = pd.concat([results_df, new_row], ignore_index=True)
 
75
  except Exception as e:
76
  return f"An error occurred: {str(e)}"
77
 
 
55
  def process_images(uploaded_file):
56
  # Reinitialize the DataFrame each time this function is called
57
  results_df = pd.DataFrame(columns=["Filename", "Extracted Text", "Translated Text"])
58
+ print("DataFrame reinitialized:", results_df) # Debugging statement
59
 
60
  file_path = uploaded_file.name # Gradio provides the file path through the .name attribute
61
+ print("Processing file:", file_path) # Debugging statement
62
 
63
  try:
64
  image_files = unzip_and_find_jpgs(file_path)
65
+ print("Found image files:", image_files) # Debugging statement
66
 
67
  if not image_files:
68
  return "No JPG files found in the zip."
 
75
  "Translated Text": translated_text
76
  }])
77
  results_df = pd.concat([results_df, new_row], ignore_index=True)
78
+ print("Current DataFrame state:", results_df) # Debugging statement
79
  except Exception as e:
80
  return f"An error occurred: {str(e)}"
81