Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ from fastapi import FastAPI, File, UploadFile, HTTPException
|
|
15 |
from fastapi.responses import HTMLResponse
|
16 |
from fastapi.staticfiles import StaticFiles
|
17 |
from fastapi.responses import StreamingResponse
|
|
|
18 |
|
19 |
import uvicorn
|
20 |
|
@@ -260,7 +261,8 @@ def simple_chat(message: dict, temperature: float = 0.8, max_length: int = 4096,
|
|
260 |
buffer += new_text
|
261 |
yield buffer.encode('utf-8')
|
262 |
|
263 |
-
return StreamingResponse(generate(), media_type="text/plain")
|
|
|
264 |
|
265 |
@app.post("/chat/")
|
266 |
async def test_endpoint(message: dict):
|
|
|
15 |
from fastapi.responses import HTMLResponse
|
16 |
from fastapi.staticfiles import StaticFiles
|
17 |
from fastapi.responses import StreamingResponse
|
18 |
+
from fastapi.responses import PlainTextResponse
|
19 |
|
20 |
import uvicorn
|
21 |
|
|
|
261 |
buffer += new_text
|
262 |
yield buffer.encode('utf-8')
|
263 |
|
264 |
+
#return StreamingResponse(generate(), media_type="text/plain")
|
265 |
+
return PlainTextResponse(generated_text)
|
266 |
|
267 |
@app.post("/chat/")
|
268 |
async def test_endpoint(message: dict):
|