Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ from google.api_core.client_options import ClientOptions
|
|
10 |
from google.cloud import documentai_v1 as documentai
|
11 |
from google.cloud.documentai_v1.types import RawDocument
|
12 |
from google.cloud import translate_v2 as translate
|
|
|
13 |
|
14 |
# Setup logging
|
15 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
@@ -100,12 +101,14 @@ def process_images(uploaded_file):
|
|
100 |
logging.info("Processing complete. Generating HTML output.")
|
101 |
return results_df.to_html()
|
102 |
|
103 |
-
|
|
|
104 |
fn=process_images,
|
105 |
-
inputs=gr.components.File(label="Upload ZIP File"),
|
106 |
outputs="html",
|
107 |
title="Document AI Translation",
|
108 |
-
description="Upload a ZIP file containing JPEG/JPG images, and the system will extract and translate text from each image."
|
|
|
109 |
)
|
110 |
|
111 |
if __name__ == "__main__":
|
|
|
10 |
from google.cloud import documentai_v1 as documentai
|
11 |
from google.cloud.documentai_v1.types import RawDocument
|
12 |
from google.cloud import translate_v2 as translate
|
13 |
+
from gradio import Interface
|
14 |
|
15 |
# Setup logging
|
16 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
101 |
logging.info("Processing complete. Generating HTML output.")
|
102 |
return results_df.to_html()
|
103 |
|
104 |
+
# Set up the interface
|
105 |
+
interface = Interface(
|
106 |
fn=process_images,
|
107 |
+
inputs=gr.components.File(label="Upload ZIP File", type="file"),
|
108 |
outputs="html",
|
109 |
title="Document AI Translation",
|
110 |
+
description="Upload a ZIP file containing JPEG/JPG images, and the system will extract and translate text from each image.",
|
111 |
+
debug=True
|
112 |
)
|
113 |
|
114 |
if __name__ == "__main__":
|