belalmunsh
commited on
Commit
•
193d727
1
Parent(s):
245e680
Create app.py
Browse files
app.py
CHANGED
@@ -1,41 +1,15 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
answer = qa_model(question=question, context=context)
|
17 |
-
return answer['answer']
|
18 |
-
|
19 |
-
# Create interface
|
20 |
-
with gr.Blocks() as demo:
|
21 |
-
gr.Markdown("# My Study Assistant")
|
22 |
-
|
23 |
-
# File upload
|
24 |
-
file_input = gr.File(label="Upload PDF")
|
25 |
-
|
26 |
-
# Text display
|
27 |
-
text_output = gr.Textbox(label="Extracted Text")
|
28 |
-
|
29 |
-
# Chat interface
|
30 |
-
question = gr.Textbox(label="Ask a question")
|
31 |
-
answer = gr.Textbox(label="Answer")
|
32 |
-
|
33 |
-
# Buttons
|
34 |
-
upload_btn = gr.Button("Process PDF")
|
35 |
-
ask_btn = gr.Button("Ask")
|
36 |
-
|
37 |
-
# Set up actions
|
38 |
-
upload_btn.click(process_pdf, inputs=file_input, outputs=text_output)
|
39 |
-
ask_btn.click(answer_question, inputs=[question, text_output], outputs=answer)
|
40 |
-
|
41 |
-
demo.launch()
|
|
|
1 |
+
STUDY_PROMPTS = {
|
2 |
+
"analyze": """
|
3 |
+
Analyze this text following these rules:
|
4 |
+
1. Identify key concepts
|
5 |
+
2. Break down complex terms
|
6 |
+
3. Provide examples
|
7 |
+
4. Link to prerequisites
|
8 |
+
""",
|
9 |
+
"practice": """
|
10 |
+
Create practice materials:
|
11 |
+
1. Generate questions
|
12 |
+
2. Provide sample problems
|
13 |
+
3. Include answer explanations
|
14 |
+
"""
|
15 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|