1MR commited on
Commit
a8040a5
·
verified ·
1 Parent(s): 0efb0b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -41,7 +41,17 @@ def text_to_pcm_array(text: str) -> str:
41
 
42
 
43
  # ---------- ENDPOINT ----------
 
 
 
 
 
 
 
 
 
 
44
  @app.post("/send_message_recive_pcm", response_class=PlainTextResponse)
45
- async def send_message_recive_pcm(message: str = Form(...)):
46
- pcm_array = text_to_pcm_array(message)
47
- return pcm_array
 
41
 
42
 
43
  # ---------- ENDPOINT ----------
44
+ # @app.post("/send_message_recive_pcm", response_class=PlainTextResponse)
45
+ # async def send_message_recive_pcm(message: str = Form(...)):
46
+ # pcm_array = text_to_pcm_array(message)
47
+ # return pcm_array
48
+
49
+ from pydantic import BaseModel
50
+
51
+ class Request(BaseModel):
52
+ message: str
53
+
54
  @app.post("/send_message_recive_pcm", response_class=PlainTextResponse)
55
+ async def send_message_recive_pcm(req: Request):
56
+ pcm_array = text_to_pcm_array(req.message)
57
+ return pcm_array