forked from EveryInc/transcriptbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (27 loc) · 911 Bytes
/
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
from flask import Flask, request, jsonify, send_from_directory, redirect, url_for
from pinecone_question_answering import answer_question
import json
app = Flask(__name__)
@app.route('/<path:path>')
def serve_static(path):
# Serve file from public directory
return send_from_directory('public', path)
@app.route('/')
def index():
return send_from_directory('public', 'index.html')
@app.route('/ask-huberman', methods=['POST'])
def ask():
# Get message from request body
data = json.loads(request.data)
# Extract transcript and promptType from data
transcript = data['transcript']
promptType = data['promptType']
messages = data['messages']
style = data['style']
persona = data['persona']
last_message = messages[-1]["message"]
# Generate response
response = answer_question(last_message)
return response
if __name__ == '__main__':
app.run()