Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, request, jsonify
|
| 2 |
+
import asyncio
|
| 3 |
+
from hypercorn.asyncio import serve
|
| 4 |
+
from hypercorn.config import Config
|
| 5 |
+
import os
|
| 6 |
+
os.environ['CURL_CA_BUNDLE'] = ''
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
app = Flask(__name__)
|
| 11 |
+
transcriptions = {}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@app.route('/<username>', methods=['POST'])
|
| 15 |
+
def handle_transcription(username):
|
| 16 |
+
data = request.get_json()
|
| 17 |
+
GET = data.get('transcription', '')
|
| 18 |
+
transcriptions[username] = GET
|
| 19 |
+
#print("Received Transcription:", transcription)
|
| 20 |
+
return jsonify({"status": "success", "message": "Transcription received"})
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
config = Config()
|
| 24 |
+
config.bind = ["0.0.0.0:7860"] # You can specify the host and port here
|
| 25 |
+
asyncio.run(serve(app, config))
|