Spaces:
Sleeping
Sleeping
Add echo endpoint
Browse files
main.py
CHANGED
@@ -17,6 +17,9 @@ class Item(BaseModel):
|
|
17 |
top_p: float = 0.15
|
18 |
repetition_penalty: float = 1.0
|
19 |
|
|
|
|
|
|
|
20 |
def format_prompt(message, history):
|
21 |
prompt = "<s>"
|
22 |
for user_prompt, bot_response in history:
|
@@ -55,3 +58,7 @@ async def generate_text(item: Item):
|
|
55 |
@app.get("/")
|
56 |
async def home():
|
57 |
return {"msg":"hey"}
|
|
|
|
|
|
|
|
|
|
17 |
top_p: float = 0.15
|
18 |
repetition_penalty: float = 1.0
|
19 |
|
20 |
+
class EchoMessage(BaseModel):
|
21 |
+
message: str
|
22 |
+
|
23 |
def format_prompt(message, history):
|
24 |
prompt = "<s>"
|
25 |
for user_prompt, bot_response in history:
|
|
|
58 |
@app.get("/")
|
59 |
async def home():
|
60 |
return {"msg":"hey"}
|
61 |
+
|
62 |
+
@app.post("/echo/")
|
63 |
+
async def echo(echo_msg: EchoMessage):
|
64 |
+
return {"msg":echo_msg.message}
|