Commit 519e2797 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent 1b040143
......@@ -81,9 +81,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
body = await request.body()
print(body)
print(type(body))
name = hashlib.sha256(body).hexdigest()
SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/")
......@@ -91,8 +88,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3")
file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json")
print(file_path)
# Check if the file already exists in the cache
if file_path.is_file():
return FileResponse(file_path)
......@@ -110,8 +105,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
stream=True,
)
print(r)
r.raise_for_status()
# Save the streaming content to a file
......@@ -125,12 +118,6 @@ async def speech(request: Request, user=Depends(get_current_user)):
# Return the saved file
return FileResponse(file_path)
# return StreamingResponse(
# r.iter_content(chunk_size=8192),
# status_code=r.status_code,
# headers=dict(r.headers),
# )
except Exception as e:
print(e)
error_detail = "Ollama WebUI: Server Connection Error"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment