Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,18 +26,18 @@ def generate_lesson(doc_text=None, pdf_file=None):
|
|
26 |
logger.info(f"Processing uploaded PDF file: {pdf_file.name}")
|
27 |
doc_text = pdf_to_text(pdf_file.name)
|
28 |
|
29 |
-
logger.info("Processing the document text.")
|
30 |
-
|
31 |
-
|
32 |
-
logger.info("
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
|
42 |
except Exception as e:
|
43 |
logger.error(f"Error occurred while generating lesson: {str(e)}")
|
|
|
26 |
logger.info(f"Processing uploaded PDF file: {pdf_file.name}")
|
27 |
doc_text = pdf_to_text(pdf_file.name)
|
28 |
|
29 |
+
logger.info("Processing the document text with general model.")
|
30 |
+
general_model_output = process_large_text(doc_text)
|
31 |
+
|
32 |
+
logger.info("Refining the output with fine-tuned model.")
|
33 |
+
refined_output = refine_with_fine_tuned_model(general_model_output)
|
34 |
+
|
35 |
+
output_path = "/tmp/refined_output.txt"
|
36 |
+
with open(output_path, "w") as file:
|
37 |
+
file.write(refined_output)
|
38 |
+
|
39 |
+
logger.info(f"Lesson generated successfully. Output saved to: {output_path}")
|
40 |
+
return refined_output, gr.File(output_path)
|
41 |
|
42 |
except Exception as e:
|
43 |
logger.error(f"Error occurred while generating lesson: {str(e)}")
|