suwonpabby commited on
Commit
771ccf8
1 Parent(s): c861cde
Files changed (1) hide show
  1. app.py +8 -3
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, Query
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.get("/")
242
- async def root_endpoint(QA: List[str] = Query(...), candidates: List[str] = Query(...), top_k: int = Query(...), character_type: int = Query(...)):
 
 
 
 
 
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