-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
43 lines (31 loc) · 960 Bytes
/
main.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
import transcript
import summarize
def main(link):
print(link)
try:
transcripted = transcript.youtubeLinkInput(link)
summary = summarize.summarize(transcripted)
return summary
except:
return "Sorry OPEN AI is having difficulties"
#return "This proves that all this works"
from flask import Flask, request
import json
# start of David's code
app = Flask(__name__, static_url_path='')
# pull static files(index.html) using our flask server
@app.route('/', methods=['GET'])
def root():
return app.send_static_file('index.html')
@app.route('/api/process_video', methods=['POST'])
def process_text():
# Parse the request body
data = request.get_json()
# Extract the text from the request body
text = data['inputUrl']
# Process the text
processed_text = main(text)
# Return the processed text as a response
return processed_text
if __name__ == '__main__':
app.run(port = 8000)