kpal002 commited on
Commit
7a66661
1 Parent(s): c115344

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -59,6 +59,7 @@ 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
 
63
 
64
  # Helper function to check if the file extension is allowed
@@ -175,11 +176,12 @@ def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
175
  qa_author_prompt_with_example = info_prompt.replace("{few_shot_examples}", formatted_author_example)
176
  qa_journal_prompt_with_example = info_prompt.replace("{few_shot_examples}", formatted_journal_example)
177
 
178
- info_llm = OpenAI(model="gpt-4-1106-preview", temperature=model_temperature, max_tokens=output_token_size)
179
  pdf_info_query = PDFQueryEngine(documents, info_llm, embed_model, (info_prompt))
180
  info_query_engine = pdf_info_query.setup_query_engine()
181
  journal_result = info_query_engine.query(modified_journal_query).response
182
  author_result = info_query_engine.query(author_query).response
 
183
 
184
 
185
  pdf_criteria_query = PDFQueryEngine(documents, info_llm, embed_model, (general_prompt))
@@ -203,7 +205,7 @@ def process_pdf(uploaded_file, llm_model, n_criteria = num_criteria):
203
  score_bar_html = generate_score_bar(total_score, n_criteria)
204
 
205
  # Return the score as a string and the reasoning as HTML
206
- return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_result
207
 
208
 
209
  with gr.Blocks(theme=gr.themes.Glass(
@@ -226,6 +228,13 @@ with gr.Blocks(theme=gr.themes.Glass(
226
  score_bar_output = gr.HTML()
227
  reasoning_output = gr.HTML()
228
 
 
 
 
 
 
 
 
229
  # Heading for Author Information
230
  gr.Markdown("## Author Information")
231
 
@@ -236,7 +245,7 @@ with gr.Blocks(theme=gr.themes.Glass(
236
  submit_button.click(
237
  fn=process_pdf,
238
  inputs=[file_upload, model_choice],
239
- outputs=[score_output, score_bar_output, reasoning_output, author_info_output]
240
  )
241
 
242
 
 
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
 
176
  qa_author_prompt_with_example = info_prompt.replace("{few_shot_examples}", formatted_author_example)
177
  qa_journal_prompt_with_example = info_prompt.replace("{few_shot_examples}", formatted_journal_example)
178
 
179
+ info_llm = OpenAI(model="gpt-4-1106-preview", temperature=model_temperature, max_tokens=100)
180
  pdf_info_query = PDFQueryEngine(documents, info_llm, embed_model, (info_prompt))
181
  info_query_engine = pdf_info_query.setup_query_engine()
182
  journal_result = info_query_engine.query(modified_journal_query).response
183
  author_result = info_query_engine.query(author_query).response
184
+ title_result = info_query_engine.query(title_query).response
185
 
186
 
187
  pdf_criteria_query = PDFQueryEngine(documents, info_llm, embed_model, (general_prompt))
 
205
  score_bar_html = generate_score_bar(total_score, n_criteria)
206
 
207
  # Return the score as a string and the reasoning as HTML
208
+ return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_result, title_result
209
 
210
 
211
  with gr.Blocks(theme=gr.themes.Glass(
 
228
  score_bar_output = gr.HTML()
229
  reasoning_output = gr.HTML()
230
 
231
+ # Heading for Author Information
232
+ gr.Markdown("## Title of the paper")
233
+
234
+ # Output for dynamically generated author information
235
+ title_info_output = gr.Markdown()
236
+
237
+
238
  # Heading for Author Information
239
  gr.Markdown("## Author Information")
240
 
 
245
  submit_button.click(
246
  fn=process_pdf,
247
  inputs=[file_upload, model_choice],
248
+ outputs=[score_output, score_bar_output, reasoning_output, author_info_output, title_info_output]
249
  )
250
 
251