Spaces:
Runtime error
Runtime error
AkshayaKeerthi
commited on
Commit
•
dbce713
1
Parent(s):
73fb0b0
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from transformers import pipeline
|
|
6 |
app = FastAPI()
|
7 |
|
8 |
# Uncomment and set up the model if needed
|
9 |
-
|
10 |
|
11 |
# Serve static files (e.g., CSS, JS, images)
|
12 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
@@ -21,6 +21,6 @@ async def home(request: Request):
|
|
21 |
async def predict(request: Request):
|
22 |
data = await request.json()
|
23 |
user_input = data.get('message')
|
24 |
-
|
25 |
-
|
26 |
return JSONResponse(content={'response': response_text})
|
|
|
6 |
app = FastAPI()
|
7 |
|
8 |
# Uncomment and set up the model if needed
|
9 |
+
model = pipeline('question-answering', model='bert-large-uncased-whole-word-masking-finetuned-squad', revision='main')
|
10 |
|
11 |
# Serve static files (e.g., CSS, JS, images)
|
12 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
21 |
async def predict(request: Request):
|
22 |
data = await request.json()
|
23 |
user_input = data.get('message')
|
24 |
+
result = model(user_input)
|
25 |
+
response_text = result[0]['generated_text']
|
26 |
return JSONResponse(content={'response': response_text})
|