Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,6 @@ num_criteria = len(queries)
|
|
59 |
|
60 |
author_query = config_manager.get_config_value("model", "author_query")
|
61 |
journal_query = config_manager.get_config_value("model", "journal_query")
|
62 |
-
title_query = config_manager.get_config_value("model", "title_query")
|
63 |
|
64 |
|
65 |
# Helper function to check if the file extension is allowed
|
@@ -109,7 +108,7 @@ def format_example(example):
|
|
109 |
def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
|
110 |
# Process the PDF file
|
111 |
pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
|
112 |
-
merged_chunks, tables = pdf_processor.process_pdf_file(uploaded_file)
|
113 |
documents = [Document(text=t) for t in merged_chunks]
|
114 |
|
115 |
# Prompts and Queries
|
@@ -176,7 +175,6 @@ def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
|
|
176 |
info_query_engine = pdf_info_query.setup_query_engine()
|
177 |
journal_result = info_query_engine.query(modified_journal_query).response
|
178 |
author_result = info_query_engine.query(author_query).response
|
179 |
-
title_result = info_query_engine.query(title_query).response
|
180 |
|
181 |
|
182 |
pdf_criteria_query = PDFQueryEngine(documents, llm, embed_model, (general_prompt))
|
@@ -200,7 +198,7 @@ def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
|
|
200 |
score_bar_html = generate_score_bar(total_score, n_criteria)
|
201 |
|
202 |
# Return the score as a string and the reasoning as HTML
|
203 |
-
return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_result,
|
204 |
|
205 |
|
206 |
with gr.Blocks(theme=gr.themes.Glass(
|
|
|
59 |
|
60 |
author_query = config_manager.get_config_value("model", "author_query")
|
61 |
journal_query = config_manager.get_config_value("model", "journal_query")
|
|
|
62 |
|
63 |
|
64 |
# Helper function to check if the file extension is allowed
|
|
|
108 |
def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
|
109 |
# Process the PDF file
|
110 |
pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
|
111 |
+
merged_chunks, tables, title = pdf_processor.process_pdf_file(uploaded_file)
|
112 |
documents = [Document(text=t) for t in merged_chunks]
|
113 |
|
114 |
# Prompts and Queries
|
|
|
175 |
info_query_engine = pdf_info_query.setup_query_engine()
|
176 |
journal_result = info_query_engine.query(modified_journal_query).response
|
177 |
author_result = info_query_engine.query(author_query).response
|
|
|
178 |
|
179 |
|
180 |
pdf_criteria_query = PDFQueryEngine(documents, llm, embed_model, (general_prompt))
|
|
|
198 |
score_bar_html = generate_score_bar(total_score, n_criteria)
|
199 |
|
200 |
# Return the score as a string and the reasoning as HTML
|
201 |
+
return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_result, title
|
202 |
|
203 |
|
204 |
with gr.Blocks(theme=gr.themes.Glass(
|