Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,13 +11,17 @@ app = Flask(__name__)
|
|
| 11 |
transcriptions = {}
|
| 12 |
|
| 13 |
|
| 14 |
-
@app.route('/<username>', methods=['POST'])
|
| 15 |
def handle_transcription(username):
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
config = Config()
|
|
|
|
| 11 |
transcriptions = {}
|
| 12 |
|
| 13 |
|
| 14 |
+
@app.route('/<username>', methods=['POST', 'GET'])
|
| 15 |
def handle_transcription(username):
|
| 16 |
+
if request.method == 'POST':
|
| 17 |
+
data = request.get_json()
|
| 18 |
+
transcription = data.get('transcription', '')
|
| 19 |
+
transcriptions[username] = transcription # Store the transcription
|
| 20 |
+
return jsonify({"status": "success", "message": "Transcription received"})
|
| 21 |
+
elif request.method == 'GET':
|
| 22 |
+
transcription = transcriptions.get(username, 'N/A')
|
| 23 |
+
return jsonify({"transcription": transcription})
|
| 24 |
+
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|
| 27 |
config = Config()
|