shukdevdatta123 commited on
Commit
b94d84a
·
verified ·
1 Parent(s): cfba4fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -35,6 +35,11 @@ def generate_review(api_key, uploaded_files, review_question, include_tables):
35
  if not review_question:
36
  return "Please enter a review question."
37
 
 
 
 
 
 
38
  system_prompt = """
39
  You are an expert academic assistant. Create a systematic review in HTML format using <h2>, <h3>, <p>, <ul>, and <table> tags. The Systematic Review must be in great details. Structure it using these steps:
40
  Step 1: Identify a Research Field
@@ -108,4 +113,4 @@ interface = gr.Interface(
108
  description="Generate a polished and structured systematic review from multiple uploaded research papers."
109
  )
110
 
111
- interface.launch(share=True)
 
35
  if not review_question:
36
  return "Please enter a review question."
37
 
38
+ # File type validation: check if all uploaded files are PDFs
39
+ for file in uploaded_files:
40
+ if not file.name.lower().endswith('.pdf'):
41
+ return f"Invalid file type. Please upload a PDF file, but '{file.name}' is not a PDF."
42
+
43
  system_prompt = """
44
  You are an expert academic assistant. Create a systematic review in HTML format using <h2>, <h3>, <p>, <ul>, and <table> tags. The Systematic Review must be in great details. Structure it using these steps:
45
  Step 1: Identify a Research Field
 
113
  description="Generate a polished and structured systematic review from multiple uploaded research papers."
114
  )
115
 
116
+ interface.launch(share=True)