Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,9 +134,10 @@ Berikut kami informasikan kekurangan dokumen yang *WAJIB* dibawa saat biometric
|
|
| 134 |
model="gemini-2.0-flash-lite",
|
| 135 |
contents=[prompt] + images,
|
| 136 |
config=GenerateContentConfig(
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
| 140 |
)
|
| 141 |
analysis = response_1.text
|
| 142 |
# Perform valid list generation
|
|
@@ -145,9 +146,10 @@ Berikut kami informasikan kekurangan dokumen yang *WAJIB* dibawa saat biometric
|
|
| 145 |
model="gemini-2.0-flash-lite",
|
| 146 |
contents=[analysis, prompt_2], # Pass prompt and image files
|
| 147 |
config=GenerateContentConfig(
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
| 151 |
)
|
| 152 |
valid_docs_list_raw = response_2.text.strip().lower()
|
| 153 |
if '\n' in valid_docs_list_raw:
|
|
@@ -190,7 +192,8 @@ Output:
|
|
| 190 |
contents=[prompt_3, image],
|
| 191 |
config=GenerateContentConfig(
|
| 192 |
temperature=0.2,
|
| 193 |
-
top_p=0.2
|
|
|
|
| 194 |
)
|
| 195 |
)
|
| 196 |
filename = response.text.strip().lower()
|
|
@@ -212,7 +215,7 @@ Output:
|
|
| 212 |
temp_dir = tempfile.mkdtemp()
|
| 213 |
zip_path = os.path.join(tempfile.gettempdir(), zip_name)
|
| 214 |
|
| 215 |
-
with zipfile.ZipFile(zip_path, 'w') as zipf:
|
| 216 |
for doc_name, images in grouped.items():
|
| 217 |
images_rgb = [img.convert("RGB") for img in images]
|
| 218 |
pdf_path = os.path.join(temp_dir, f"{doc_name}.pdf")
|
|
|
|
| 134 |
model="gemini-2.0-flash-lite",
|
| 135 |
contents=[prompt] + images,
|
| 136 |
config=GenerateContentConfig(
|
| 137 |
+
temperature=0.2,
|
| 138 |
+
top_p=0.2,
|
| 139 |
+
maxOutputTokens=500
|
| 140 |
+
)
|
| 141 |
)
|
| 142 |
analysis = response_1.text
|
| 143 |
# Perform valid list generation
|
|
|
|
| 146 |
model="gemini-2.0-flash-lite",
|
| 147 |
contents=[analysis, prompt_2], # Pass prompt and image files
|
| 148 |
config=GenerateContentConfig(
|
| 149 |
+
temperature=0.2,
|
| 150 |
+
top_p=0.2,
|
| 151 |
+
maxOutputTokens=200
|
| 152 |
+
)
|
| 153 |
)
|
| 154 |
valid_docs_list_raw = response_2.text.strip().lower()
|
| 155 |
if '\n' in valid_docs_list_raw:
|
|
|
|
| 192 |
contents=[prompt_3, image],
|
| 193 |
config=GenerateContentConfig(
|
| 194 |
temperature=0.2,
|
| 195 |
+
top_p=0.2,
|
| 196 |
+
maxOutputTokens=200
|
| 197 |
)
|
| 198 |
)
|
| 199 |
filename = response.text.strip().lower()
|
|
|
|
| 215 |
temp_dir = tempfile.mkdtemp()
|
| 216 |
zip_path = os.path.join(tempfile.gettempdir(), zip_name)
|
| 217 |
|
| 218 |
+
with zipfile.ZipFile(zip_path, 'w', compression=zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
|
| 219 |
for doc_name, images in grouped.items():
|
| 220 |
images_rgb = [img.convert("RGB") for img in images]
|
| 221 |
pdf_path = os.path.join(temp_dir, f"{doc_name}.pdf")
|