Spaces:
Running
Running
Commit
·
894d55e
1
Parent(s):
dc569e4
Final app
Browse files
app.py
CHANGED
|
@@ -95,18 +95,27 @@ def process_file(file):
|
|
| 95 |
return f"❌ Error: {str(e)}"
|
| 96 |
|
| 97 |
def generate_prompt(context, question):
|
| 98 |
-
return f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
{context}
|
| 100 |
|
| 101 |
-
Question:
|
| 102 |
{question}
|
| 103 |
|
| 104 |
-
|
| 105 |
-
-
|
| 106 |
-
-
|
| 107 |
-
-
|
| 108 |
-
-
|
| 109 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
def detect_question_type(q):
|
| 112 |
q = q.lower().strip()
|
|
|
|
| 95 |
return f"❌ Error: {str(e)}"
|
| 96 |
|
| 97 |
def generate_prompt(context, question):
|
| 98 |
+
return f"""You are a helpful and intelligent academic assistant.
|
| 99 |
+
|
| 100 |
+
Use the following class material to answer a student's question.
|
| 101 |
+
|
| 102 |
+
Material:
|
| 103 |
{context}
|
| 104 |
|
| 105 |
+
Student's Question:
|
| 106 |
{question}
|
| 107 |
|
| 108 |
+
Answer the question with:
|
| 109 |
+
- Structured academic explanation
|
| 110 |
+
- Relevant details from the material (e.g., examples like FIFO, LRU)
|
| 111 |
+
- No repetition
|
| 112 |
+
- No outside knowledge
|
| 113 |
+
- No prompt words like "context" or "question"
|
| 114 |
+
- Use markdown formatting with headings and lists where helpful
|
| 115 |
+
|
| 116 |
+
If the material does not have enough information, say: "The material does not contain enough information to answer this accurately."
|
| 117 |
+
"""
|
| 118 |
+
|
| 119 |
|
| 120 |
def detect_question_type(q):
|
| 121 |
q = q.lower().strip()
|