Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,13 +109,6 @@ def gemini_analysis(images, tanggal_berangkat, tanggal_pulang, api_key):
|
|
| 109 |
3 bulan terakhir
|
| 110 |
Jika suami lengkap β istri cukup lampirkan rekening koran suami
|
| 111 |
---
|
| 112 |
-
TEMPLATE PESAN PEMBERITAHUAN (notice_msg):
|
| 113 |
-
Berikut kami informasikan kekurangan dokumen yang *WAJIB* dibawa saat biometric visa schengen nanti ya :
|
| 114 |
-
|
| 115 |
-
1. ...
|
| 116 |
-
2. ...
|
| 117 |
-
3. ...
|
| 118 |
-
---
|
| 119 |
TEMPLATE OUTPUT JAWABAN DALAM FORMAT JSON:
|
| 120 |
{
|
| 121 |
"analysis":
|
|
@@ -160,6 +153,19 @@ def gemini_analysis(images, tanggal_berangkat, tanggal_pulang, api_key):
|
|
| 160 |
"Traveling and living cost covered by":"..."
|
| 161 |
} # Hanya isi yang ada di dokumen saja. Jika tidak ada, tidak usah diisi atau dimunculkan
|
| 162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
'''
|
| 164 |
|
| 165 |
# Perform document analysis
|
|
@@ -281,7 +287,7 @@ def main_process(files, tanggal_berangkat, tanggal_pulang, api_key):
|
|
| 281 |
# Create DOCX for summary output
|
| 282 |
doc = Document()
|
| 283 |
doc.add_heading("Visa Document Check Summary", level=1)
|
| 284 |
-
for line in
|
| 285 |
doc.add_paragraph(line)
|
| 286 |
first_file = files[0]
|
| 287 |
first_filename = os.path.basename(first_file.name if hasattr(first_file, 'name') else first_file)
|
|
@@ -292,7 +298,7 @@ def main_process(files, tanggal_berangkat, tanggal_pulang, api_key):
|
|
| 292 |
|
| 293 |
# Filtering the file
|
| 294 |
zip_file_path = process_and_zip_all_images(all_images, api_key, zip_name=f'All_PDF_Docs_{base_name}.zip')
|
| 295 |
-
return temp_docx_path, form_filling_str, zip_file_path, invalid_list_str
|
| 296 |
|
| 297 |
|
| 298 |
# Gradio UI update: add ".zip" to accepted file types
|
|
@@ -330,11 +336,14 @@ with gr.Blocks() as demo:
|
|
| 330 |
|
| 331 |
form_filling_output = gr.Textbox(label="π FORM FILLING RESULT", lines=5)
|
| 332 |
invalid_list_output = gr.Textbox(label="π INVALID DOCUMENT LIST", lines=5)
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
run_btn.click(
|
| 335 |
fn=main_process,
|
| 336 |
inputs=[file_input, tanggal_berangkat, tanggal_pulang, api_key],
|
| 337 |
-
outputs=[download_output_docx, form_filling_output, download_valid_zip, invalid_list_output]
|
| 338 |
)
|
| 339 |
|
| 340 |
demo.launch(debug=True)
|
|
|
|
| 109 |
3 bulan terakhir
|
| 110 |
Jika suami lengkap β istri cukup lampirkan rekening koran suami
|
| 111 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
TEMPLATE OUTPUT JAWABAN DALAM FORMAT JSON:
|
| 113 |
{
|
| 114 |
"analysis":
|
|
|
|
| 153 |
"Traveling and living cost covered by":"..."
|
| 154 |
} # Hanya isi yang ada di dokumen saja. Jika tidak ada, tidak usah diisi atau dimunculkan
|
| 155 |
}
|
| 156 |
+
---
|
| 157 |
+
TEMPLATE PESAN PEMBERITAHUAN (notice_msg):
|
| 158 |
+
Berikut kami informasikan kekurangan dokumen yang *WAJIB* dibawa saat biometric visa schengen nanti ya :
|
| 159 |
+
|
| 160 |
+
1. ...
|
| 161 |
+
2. ...
|
| 162 |
+
3. ...
|
| 163 |
+
---
|
| 164 |
+
TEMPLATE SUMMARY:
|
| 165 |
+
List Dokumen yang sudah valid: ....
|
| 166 |
+
List Dokumen yang belum ada / perlu diperbaiki / perlu cek ulang : ...
|
| 167 |
+
Analisis detail keseluruhan : ...
|
| 168 |
+
---
|
| 169 |
'''
|
| 170 |
|
| 171 |
# Perform document analysis
|
|
|
|
| 287 |
# Create DOCX for summary output
|
| 288 |
doc = Document()
|
| 289 |
doc.add_heading("Visa Document Check Summary", level=1)
|
| 290 |
+
for line in analysis_str.split("\n"):
|
| 291 |
doc.add_paragraph(line)
|
| 292 |
first_file = files[0]
|
| 293 |
first_filename = os.path.basename(first_file.name if hasattr(first_file, 'name') else first_file)
|
|
|
|
| 298 |
|
| 299 |
# Filtering the file
|
| 300 |
zip_file_path = process_and_zip_all_images(all_images, api_key, zip_name=f'All_PDF_Docs_{base_name}.zip')
|
| 301 |
+
return temp_docx_path, form_filling_str, zip_file_path, invalid_list_str, raw_output, summary, notice_msg
|
| 302 |
|
| 303 |
|
| 304 |
# Gradio UI update: add ".zip" to accepted file types
|
|
|
|
| 336 |
|
| 337 |
form_filling_output = gr.Textbox(label="π FORM FILLING RESULT", lines=5)
|
| 338 |
invalid_list_output = gr.Textbox(label="π INVALID DOCUMENT LIST", lines=5)
|
| 339 |
+
summary_output = gr.Textbox(label="π SUMMARY OUTPUT", lines=5)
|
| 340 |
+
notice_msg = gr.Textbox(label="π NOTIFICATION MSG", lines=5)
|
| 341 |
+
raw_output = gr.Textbox(label="π RAW OUTPUT", lines=5)
|
| 342 |
|
| 343 |
run_btn.click(
|
| 344 |
fn=main_process,
|
| 345 |
inputs=[file_input, tanggal_berangkat, tanggal_pulang, api_key],
|
| 346 |
+
outputs=[download_output_docx, form_filling_output, download_valid_zip, invalid_list_output, raw_output, summary_output, notice_msg]
|
| 347 |
)
|
| 348 |
|
| 349 |
demo.launch(debug=True)
|