diff --git a/app.py b/app.py index d82c51f0d..3b987398c 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,55 @@ -from flask import Flask +from flask import Flask, request +import os +import openai + app = Flask(__name__) +openai.api_key = 'YOUR_OPEN_AI_KEY' @app.route('/') -def hello_world(): - return 'Hello, World!' +def index(): + return """ + + + + + + + + """ + +@app.route('/transcribe', methods=['POST']) +def transcribe_audio(): + audio_data = request.json['data'] + # Here you need to convert the base64 audio data into a format suitable for the OpenAI API. + # This will likely involve writing the data to a file, or converting it to the correct audio format. + transcript = openai.Audio.transcribe("whisper-1", audio_data) + return transcript