Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,14 +8,13 @@ app = FastAPI()
|
|
8 |
model = AutoModelForCausalLM.from_pretrained("Hadeel11/fine-tuned-model")
|
9 |
tokenizer = AutoTokenizer.from_pretrained("Hadeel11/fine-tuned-model")
|
10 |
|
11 |
-
class Query(BaseModel):
|
12 |
-
question: str
|
13 |
-
contexts: list
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
|
|
8 |
model = AutoModelForCausalLM.from_pretrained("Hadeel11/fine-tuned-model")
|
9 |
tokenizer = AutoTokenizer.from_pretrained("Hadeel11/fine-tuned-model")
|
10 |
|
|
|
|
|
|
|
11 |
|
12 |
+
|
13 |
+
@app.post("/query/")
|
14 |
+
async def query_rag(request: Request):
|
15 |
+
data = await request.json()
|
16 |
+
question = data.get("question", "")
|
17 |
+
contexts = query_qdrant(question, top_k=2)
|
18 |
+
answer = generate_answer(question, contexts)
|
19 |
+
return {"question": question, "contexts": contexts, "answer": answer}
|
20 |
|