Spaces:
Sleeping
Sleeping
Update api_app.py
Browse files- api_app.py +1 -2
api_app.py
CHANGED
|
@@ -7,8 +7,8 @@ import os
|
|
| 7 |
|
| 8 |
app = FastAPI(title="QA Dashboard Pro")
|
| 9 |
|
| 10 |
-
# Load your fine-tuned model
|
| 11 |
MODEL_PATH = "MedhaCodes/qna_finetuned_model"
|
|
|
|
| 12 |
qa_pipeline = pipeline(
|
| 13 |
"question-answering",
|
| 14 |
model=AutoModelForQuestionAnswering.from_pretrained(MODEL_PATH),
|
|
@@ -38,7 +38,6 @@ async def predict(request: Request):
|
|
| 38 |
if not context or not questions_text:
|
| 39 |
return JSONResponse({"error": "Please provide both context and question"}, status_code=400)
|
| 40 |
|
| 41 |
-
# Handle multiple questions line-by-line
|
| 42 |
questions = [q.strip() for q in questions_text.strip().split("\n") if q.strip()]
|
| 43 |
answers = []
|
| 44 |
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI(title="QA Dashboard Pro")
|
| 9 |
|
|
|
|
| 10 |
MODEL_PATH = "MedhaCodes/qna_finetuned_model"
|
| 11 |
+
|
| 12 |
qa_pipeline = pipeline(
|
| 13 |
"question-answering",
|
| 14 |
model=AutoModelForQuestionAnswering.from_pretrained(MODEL_PATH),
|
|
|
|
| 38 |
if not context or not questions_text:
|
| 39 |
return JSONResponse({"error": "Please provide both context and question"}, status_code=400)
|
| 40 |
|
|
|
|
| 41 |
questions = [q.strip() for q in questions_text.strip().split("\n") if q.strip()]
|
| 42 |
answers = []
|
| 43 |
|