diff --git a/fastapi_backend/requirements.txt b/fastapi_backend/requirements.txt index 7937eea..d2fd621 100644 --- a/fastapi_backend/requirements.txt +++ b/fastapi_backend/requirements.txt @@ -3,7 +3,7 @@ sentencepiece==0.1.99 gdown==4.7.1 fastapi==0.104.0 librosa==0.10.1 -openai==0.28.1 +openai==1.1.1 openpyxl==3.1.2 numpy==1.26.1 streamlit==1.28.0 diff --git a/fastapi_backend/server.py b/fastapi_backend/server.py index ba4b9c5..af1a80c 100644 --- a/fastapi_backend/server.py +++ b/fastapi_backend/server.py @@ -33,6 +33,7 @@ from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC import soundfile as sf import librosa +import openai import requests import time @@ -574,8 +575,7 @@ async def transcribe_endpoint(file: UploadFile = File(...)): return {"transcription": transcription} @app.post("/speech_to_text_api") -async def transcribe_api_endpoint(client_id: str = Form(...), - client_secret: str = Form(...), +async def transcribe_api_endpoint(api_key: str = Form(...), file: UploadFile = File(...)): # Save temporary audio file @@ -637,8 +637,10 @@ async def transcribe_api_endpoint(client_id: str = Form(...), temp_file.write(audio_file) temp_file_path = temp_file.name + # client = OpenAI() + with open(temp_file_path, 'rb') as open_audio_file: - transcription = openai.Audio.transcribe(model="whisper-1", file=open_audio_file, response_format="text", language='ko') + transcript = openai.audio.transcriptions.create(model="whisper-1", file=open_audio_file, response_format="text") return {"transcription": transcription} ########### Speech2Text End ############# diff --git a/streamlit_frontend/requirements.txt b/streamlit_frontend/requirements.txt index 981c411..422822d 100644 --- a/streamlit_frontend/requirements.txt +++ b/streamlit_frontend/requirements.txt @@ -1,5 +1,5 @@ openpyxl==3.1.2 -openai==0.28.1 +openai==1.1.1 streamlit==1.24.1 streamlit-modal==0.1.0 pandas==2.1.2