Update app.py
Browse files
app.py
CHANGED
|
@@ -131,7 +131,7 @@ def summarize_german_text(text):
|
|
| 131 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 132 |
return summary
|
| 133 |
|
| 134 |
-
def
|
| 135 |
sections_dict = process_pdf(path)
|
| 136 |
results = answer_questions_section_1(sections_dict["1. Kurzbeschreibung"])
|
| 137 |
results["Section 4.1 summary"] = summarize_german_text(sections_dict["4.1 Bewertungen von Zielen, Zielgruppen, Wirkungshypothesen und Indikatoren"])
|
|
@@ -142,7 +142,7 @@ def extact_details():
|
|
| 142 |
# print(f"{key}: {answer}")
|
| 143 |
|
| 144 |
if __name__ == "__main__":
|
| 145 |
-
demo = gr.Interface(fn=
|
| 146 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 147 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 148 |
title="PDF Text Extractor",
|
|
|
|
| 131 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
| 132 |
return summary
|
| 133 |
|
| 134 |
+
def extract_details(path):
|
| 135 |
sections_dict = process_pdf(path)
|
| 136 |
results = answer_questions_section_1(sections_dict["1. Kurzbeschreibung"])
|
| 137 |
results["Section 4.1 summary"] = summarize_german_text(sections_dict["4.1 Bewertungen von Zielen, Zielgruppen, Wirkungshypothesen und Indikatoren"])
|
|
|
|
| 142 |
# print(f"{key}: {answer}")
|
| 143 |
|
| 144 |
if __name__ == "__main__":
|
| 145 |
+
demo = gr.Interface(fn=extract_details,
|
| 146 |
inputs=gr.File(type="binary", label="Upload PDF"),
|
| 147 |
outputs=gr.Textbox(label="Extracted Text"),
|
| 148 |
title="PDF Text Extractor",
|