1MR commited on
Commit
4e1b108
·
verified ·
1 Parent(s): 16d6bcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -41,18 +41,18 @@ 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
48
 
49
- from fastapi.responses import StreamingResponse
50
- import io
51
 
52
- @app.post("/send_message_recive_pcm")
53
- async def send_message_recive_pcm(message: str = Form(...)):
54
- pcm_array = text_to_pcm_array(message) # numpy array dtype=int16
55
- buf = io.BytesIO()
56
- buf.write(pcm_array.tobytes())
57
- buf.seek(0)
58
- return StreamingResponse(buf, media_type="application/octet-stream")
 
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 fastapi.responses import StreamingResponse
50
+ # import io
51
 
52
+ # @app.post("/send_message_recive_pcm")
53
+ # async def send_message_recive_pcm(message: str = Form(...)):
54
+ # pcm_array = text_to_pcm_array(message) # numpy array dtype=int16
55
+ # buf = io.BytesIO()
56
+ # buf.write(pcm_array.tobytes())
57
+ # buf.seek(0)
58
+ # return StreamingResponse(buf, media_type="application/octet-stream")