api-test-stt / app.py
johnpaulbin's picture
Create app.py
ee49611 verified
raw
history blame
696 Bytes
from flask import Flask, request, jsonify
import asyncio
from hypercorn.asyncio import serve
from hypercorn.config import Config
import os
os.environ['CURL_CA_BUNDLE'] = ''
app = Flask(__name__)
transcriptions = {}
@app.route('/<username>', methods=['POST'])
def handle_transcription(username):
data = request.get_json()
GET = data.get('transcription', '')
transcriptions[username] = GET
#print("Received Transcription:", transcription)
return jsonify({"status": "success", "message": "Transcription received"})
if __name__ == "__main__":
config = Config()
config.bind = ["0.0.0.0:7860"] # You can specify the host and port here
asyncio.run(serve(app, config))