-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
70 lines (55 loc) · 1.92 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from flask import Flask, request, jsonify,render_template
from chatGPT import askGPT
from google_calendar_integration import send_calendar_notification
import os
from standup_sync import audioToText
from languages import languages
from standup_analyzer import analyze_weekly_data,askQuestion
app = Flask(__name__)
@app.route('/',methods = ['GET'])
def index():
return render_template("index.html")
@app.route('/process_audio', methods=['POST'])
def process_audio():
# Assuming the audio file is sent in the request
audio_file = request.files['audio']
language = request.form.get('language')
if language not in languages.keys():
return jsonify({
"Error" : "Error in selected Language "
})
audio_file.save('output1.wav') # Save the audio file
# Perform speech-to-text
final_text = audioToText(languages[language])
if final_text == "" or final_text is None:
response = {
'status': 'error',
'message': 'No text to process',
}
else:
# Process the text using GPT
final_result = askGPT(f"Extract insights, summary, and action items from the transcription of a daily standup meeting (DSM): {final_text}")
# Send the result to Google Calendar
send_calendar_notification(final_result)
response = {
'status': 'success',
'result': final_result,
'final_text' : final_text
}
# Delete the saved audio file
os.remove('output1.wav')
return jsonify(response)
@app.route('/analyse_weekly_data',methods = ['GET'])
def anaylzeWeeklyData():
return jsonify({
'results' : analyze_weekly_data()
})
@app.route('/questions',methods = ['POST'])
def questions():
question = request.form.get('question')
response = askQuestion(question)
return jsonify({
'result' : response
})
if __name__ == '__main__':
app.run(debug=True)