Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ embedding_model = SentenceTransformer("intfloat/e5-large")
|
|
18 |
|
19 |
print("Loading text generation model...")
|
20 |
# Use a lighter model for testing
|
21 |
-
|
22 |
|
23 |
# === Qdrant Setup ===
|
24 |
print("Connecting to Qdrant...")
|
@@ -67,9 +67,9 @@ class MathRetrievalQA(dspy.Program):
|
|
67 |
return dspy.Output(answer="", retrieved_context="")
|
68 |
prompt = f"Question: {question}\nContext: {context}\nAnswer:"
|
69 |
print("Generating answer...")
|
70 |
-
|
71 |
-
print("Generated answer:",
|
72 |
-
return {"answer":
|
73 |
|
74 |
# return dspy.Output(answer=answer, retrieved_context=context)
|
75 |
|
|
|
18 |
|
19 |
print("Loading text generation model...")
|
20 |
# Use a lighter model for testing
|
21 |
+
qa_pipeline = pipeline("text-generation", model="gpt2")
|
22 |
|
23 |
# === Qdrant Setup ===
|
24 |
print("Connecting to Qdrant...")
|
|
|
67 |
return dspy.Output(answer="", retrieved_context="")
|
68 |
prompt = f"Question: {question}\nContext: {context}\nAnswer:"
|
69 |
print("Generating answer...")
|
70 |
+
answer = qa_pipeline(prompt, max_new_tokens=100)[0]["generated_text"]
|
71 |
+
print("Generated answer:", answer)
|
72 |
+
return {"answer": answer, "retrieved_context": context}
|
73 |
|
74 |
# return dspy.Output(answer=answer, retrieved_context=context)
|
75 |
|