Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, Response, Request, Form, Body
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
|
|
|
| 3 |
import ggwave
|
| 4 |
import scipy.io.wavfile as wav
|
| 5 |
import numpy as np
|
|
@@ -8,6 +9,7 @@ from pydantic import BaseModel
|
|
| 8 |
from groq import Groq
|
| 9 |
import io
|
| 10 |
import wave
|
|
|
|
| 11 |
from typing import List, Dict, Optional
|
| 12 |
|
| 13 |
app = FastAPI()
|
|
@@ -29,11 +31,14 @@ async def serve_homepage():
|
|
| 29 |
"""Serve the chat interface HTML."""
|
| 30 |
with open("static/conv.html", "r") as f:
|
| 31 |
return Response(content=f.read(), media_type="text/html")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
@app.get("/conv/")
|
| 33 |
async def serve_convpage():
|
| 34 |
"""Serve the chat interface HTML."""
|
| 35 |
-
|
| 36 |
-
return Response(content=f.read(), media_type="text/html")
|
| 37 |
|
| 38 |
@app.post("/stt/")
|
| 39 |
async def speech_to_text(file: UploadFile = File(...)):
|
|
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, Response, Request, Form, Body
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
+
from fastapi.responses import FileResponse
|
| 4 |
import ggwave
|
| 5 |
import scipy.io.wavfile as wav
|
| 6 |
import numpy as np
|
|
|
|
| 9 |
from groq import Groq
|
| 10 |
import io
|
| 11 |
import wave
|
| 12 |
+
import json
|
| 13 |
from typing import List, Dict, Optional
|
| 14 |
|
| 15 |
app = FastAPI()
|
|
|
|
| 31 |
"""Serve the chat interface HTML."""
|
| 32 |
with open("static/conv.html", "r") as f:
|
| 33 |
return Response(content=f.read(), media_type="text/html")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
@app.get("/conv/")
|
| 39 |
async def serve_convpage():
|
| 40 |
"""Serve the chat interface HTML."""
|
| 41 |
+
return FileResponse("static/index.html")
|
|
|
|
| 42 |
|
| 43 |
@app.post("/stt/")
|
| 44 |
async def speech_to_text(file: UploadFile = File(...)):
|