Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,6 @@ os.environ["GROQ_API_KEY"] = os.getenv("GROQ_API_KEY") # Read from secrets, if
|
|
| 12 |
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
| 13 |
|
| 14 |
|
| 15 |
-
|
| 16 |
def extract_text_from_file(file):
|
| 17 |
"""
|
| 18 |
Extracts text from a PDF or Word document file.
|
|
@@ -96,11 +95,11 @@ def generate_questions(file, question_type, save_format):
|
|
| 96 |
return questions_display, None
|
| 97 |
|
| 98 |
# Gradio Interface
|
| 99 |
-
file_input = gr.
|
| 100 |
-
question_type = gr.
|
| 101 |
-
save_format = gr.
|
| 102 |
-
output_text = gr.
|
| 103 |
-
output_file = gr.
|
| 104 |
|
| 105 |
gr.Interface(
|
| 106 |
fn=generate_questions,
|
|
|
|
| 12 |
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
| 13 |
|
| 14 |
|
|
|
|
| 15 |
def extract_text_from_file(file):
|
| 16 |
"""
|
| 17 |
Extracts text from a PDF or Word document file.
|
|
|
|
| 95 |
return questions_display, None
|
| 96 |
|
| 97 |
# Gradio Interface
|
| 98 |
+
file_input = gr.File(label="Upload PDF or Word Document")
|
| 99 |
+
question_type = gr.Dropdown(["MCQ", "Fill-in-the-Blank", "Short Answer", "Concept Explanation", "Numerical"], label="Question Type")
|
| 100 |
+
save_format = gr.Dropdown(["None", "Text File", "CSV File"], label="Save Questions As")
|
| 101 |
+
output_text = gr.Textbox(label="Generated Questions")
|
| 102 |
+
output_file = gr.File(label="Download File")
|
| 103 |
|
| 104 |
gr.Interface(
|
| 105 |
fn=generate_questions,
|