Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -150,6 +150,23 @@ def main_process(files, tanggal_berangkat, tanggal_pulang):
|
|
| 150 |
|
| 151 |
summary = gemini_analysis(all_images, tanggal_berangkat, tanggal_pulang)
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
# Save to DOCX
|
| 154 |
doc = Document()
|
| 155 |
doc.add_heading("Visa Document Check Summary", level=1)
|
|
|
|
| 150 |
|
| 151 |
summary = gemini_analysis(all_images, tanggal_berangkat, tanggal_pulang)
|
| 152 |
|
| 153 |
+
# 📄 Create DOCX with custom filename
|
| 154 |
+
doc = Document()
|
| 155 |
+
doc.add_heading("Visa Document Check Summary", level=1)
|
| 156 |
+
for line in summary.split("\n"):
|
| 157 |
+
doc.add_paragraph(line)
|
| 158 |
+
|
| 159 |
+
# Use first input file name for filename
|
| 160 |
+
first_file = files[0]
|
| 161 |
+
first_filename = os.path.basename(first_file.name if hasattr(first_file, 'name') else first_file)
|
| 162 |
+
base_name = os.path.splitext(first_filename)[0]
|
| 163 |
+
docx_filename = f"summary_{base_name}.docx"
|
| 164 |
+
temp_docx_path = os.path.join(tempfile.gettempdir(), docx_filename)
|
| 165 |
+
|
| 166 |
+
doc.save(temp_docx_path)
|
| 167 |
+
|
| 168 |
+
return summary, temp_docx_path
|
| 169 |
+
|
| 170 |
# Save to DOCX
|
| 171 |
doc = Document()
|
| 172 |
doc.add_heading("Visa Document Check Summary", level=1)
|