Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -3,6 +3,7 @@ from fastapi.responses import HTMLResponse
|
|
3 |
from fastapi.responses import StreamingResponse
|
4 |
from fastapi.responses import FileResponse
|
5 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
6 |
from io import StringIO
|
7 |
import os
|
8 |
|
@@ -23,9 +24,11 @@ app.add_middleware(
|
|
23 |
allow_headers=["*"],
|
24 |
)
|
25 |
|
|
|
|
|
26 |
@app.post("/get_compressed_text")
|
27 |
-
async def get_compressed_text(
|
28 |
-
compressed_prompt = llm_lingua.compress_prompt(original_propmt, instruction="", question="")
|
29 |
print("compressed")
|
30 |
return compressed_prompt
|
31 |
|
|
|
3 |
from fastapi.responses import StreamingResponse
|
4 |
from fastapi.responses import FileResponse
|
5 |
from fastapi.middleware.cors import CORSMiddleware
|
6 |
+
from pydantic import BaseModel
|
7 |
from io import StringIO
|
8 |
import os
|
9 |
|
|
|
24 |
allow_headers=["*"],
|
25 |
)
|
26 |
|
27 |
+
class Prompt(BaseModel:
|
28 |
+
original_prompt: str
|
29 |
@app.post("/get_compressed_text")
|
30 |
+
async def get_compressed_text(prompt: Prompt):
|
31 |
+
compressed_prompt = llm_lingua.compress_prompt(prompt.original_propmt, instruction="", question="")
|
32 |
print("compressed")
|
33 |
return compressed_prompt
|
34 |
|