Spaces:
Sleeping
Sleeping
namberino
commited on
Commit
·
e4e8768
1
Parent(s):
54c2794
Initial commit
Browse files
app.py
CHANGED
|
@@ -299,6 +299,7 @@ def ui_run(pdf_file, seeds_text, questions_per_seed, k_retrieve, chunk_size, chu
|
|
| 299 |
|
| 300 |
print(f"seeds: {seeds}")
|
| 301 |
|
|
|
|
| 302 |
try:
|
| 303 |
results = generate_mcqs_from_pdf(
|
| 304 |
pdf_path=local_path,
|
|
@@ -314,12 +315,14 @@ def ui_run(pdf_file, seeds_text, questions_per_seed, k_retrieve, chunk_size, chu
|
|
| 314 |
)
|
| 315 |
except Exception as e:
|
| 316 |
return f"Lỗi khi sinh MCQ: {e}", None
|
|
|
|
| 317 |
|
| 318 |
out_json = json.dumps(results, ensure_ascii=False, indent=2)
|
| 319 |
# write output file for download
|
| 320 |
out_file = os.path.join(tmp_dir, "mcq_output.json")
|
| 321 |
with open(out_file, "w", encoding="utf-8") as f:
|
| 322 |
f.write(out_json)
|
|
|
|
| 323 |
|
| 324 |
return out_json, out_file
|
| 325 |
|
|
|
|
| 299 |
|
| 300 |
print(f"seeds: {seeds}")
|
| 301 |
|
| 302 |
+
print("generating mcqs")
|
| 303 |
try:
|
| 304 |
results = generate_mcqs_from_pdf(
|
| 305 |
pdf_path=local_path,
|
|
|
|
| 315 |
)
|
| 316 |
except Exception as e:
|
| 317 |
return f"Lỗi khi sinh MCQ: {e}", None
|
| 318 |
+
print("mcqs generated")
|
| 319 |
|
| 320 |
out_json = json.dumps(results, ensure_ascii=False, indent=2)
|
| 321 |
# write output file for download
|
| 322 |
out_file = os.path.join(tmp_dir, "mcq_output.json")
|
| 323 |
with open(out_file, "w", encoding="utf-8") as f:
|
| 324 |
f.write(out_json)
|
| 325 |
+
print("json output dumped")
|
| 326 |
|
| 327 |
return out_json, out_file
|
| 328 |
|