Update app.py
Browse files
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 = "
|
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 |
-
|
60 |
-
results_df =
|
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",
|