johnpaulbin commited on
Commit
541820f
1 Parent(s): ee49611

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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
- 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()
 
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()