Spaces:
Running
on
Zero
Running
on
Zero
suwonpabby
commited on
Commit
•
771ccf8
1
Parent(s):
c861cde
Modify
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
from http import HTTPStatus
|
3 |
from fastapi.responses import StreamingResponse
|
4 |
-
from fastapi import FastAPI,
|
5 |
from typing import List
|
6 |
from threading import Thread
|
7 |
|
@@ -238,8 +238,13 @@ def make_gen(QA, candidates, top_k, character_type):
|
|
238 |
|
239 |
|
240 |
|
241 |
-
@app.
|
242 |
-
async def root_endpoint(
|
|
|
|
|
|
|
|
|
|
|
243 |
return StreamingResponse(gen_stream(QA, candidates, top_k, character_type), media_type="text/event-stream")
|
244 |
|
245 |
|
|
|
1 |
import os
|
2 |
from http import HTTPStatus
|
3 |
from fastapi.responses import StreamingResponse
|
4 |
+
from fastapi import FastAPI, Request
|
5 |
from typing import List
|
6 |
from threading import Thread
|
7 |
|
|
|
238 |
|
239 |
|
240 |
|
241 |
+
@app.post("/")
|
242 |
+
async def root_endpoint(request: Request):
|
243 |
+
data = await request.json()
|
244 |
+
QA = data.get("QA")
|
245 |
+
candidates = data.get("candidates")
|
246 |
+
top_k = data.get("top_k")
|
247 |
+
character_type = data.get("character_type")
|
248 |
return StreamingResponse(gen_stream(QA, candidates, top_k, character_type), media_type="text/event-stream")
|
249 |
|
250 |
|