mkaramb commited on
Commit
4bf21c7
·
verified ·
1 Parent(s): 9d63c0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -18,7 +18,7 @@ results_df = pd.DataFrame(columns=["Filename", "Extracted Text", "Translated Tex
18
  # Set your Google Cloud Document AI processor details here
19
  project_id = "herbaria-ai"
20
  location = "us"
21
- processor_id = "4307b078717a399a"
22
 
23
  def translate_text(text, target_language="en"):
24
  translate_client = translate.Client()
@@ -56,9 +56,9 @@ def unzip_and_find_jpgs(file_path):
56
  return jpg_files
57
 
58
  def process_images(uploaded_file):
59
- global results_df
60
- results_df = results_df.iloc[0:0] # Clear the DataFrame at the start of the function
61
-
62
  file_path = uploaded_file.name # Gradio provides the file path through the .name attribute
63
 
64
  try:
@@ -80,6 +80,7 @@ def process_images(uploaded_file):
80
 
81
  return results_df.to_html()
82
 
 
83
  interface = gr.Interface(
84
  fn=process_images,
85
  inputs="file",
 
18
  # Set your Google Cloud Document AI processor details here
19
  project_id = "herbaria-ai"
20
  location = "us"
21
+ processor_id = "de954414712822b3"
22
 
23
  def translate_text(text, target_language="en"):
24
  translate_client = translate.Client()
 
56
  return jpg_files
57
 
58
  def process_images(uploaded_file):
59
+ # Reinitialize the DataFrame each time this function is called
60
+ results_df = pd.DataFrame(columns=["Filename", "Extracted Text", "Translated Text"])
61
+
62
  file_path = uploaded_file.name # Gradio provides the file path through the .name attribute
63
 
64
  try:
 
80
 
81
  return results_df.to_html()
82
 
83
+
84
  interface = gr.Interface(
85
  fn=process_images,
86
  inputs="file",