-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_srt_summary.py
More file actions
24 lines (20 loc) · 841 Bytes
/
Copy pathmake_srt_summary.py
File metadata and controls
24 lines (20 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from dotenv import load_dotenv
from openai_client import openai_client
from split_text import split_text
load_dotenv()
client = openai_client()
def make_srt_summary(srt_text):
sections = split_text(srt_text)
prompt = "Make a summarized list of the following srt text. Only the important points, but do not reveal the clue, but keep it in the same format as the text, just shorter and summarized, the text: "
try:
new_text = []
for section in sections:
response = client.completions.create(
model="gpt-3.5-turbo-instruct",
prompt=prompt + section,
max_tokens=600,
temperature=0.9
)
new_text.append(response.choices[0].text.strip())
except Exception as e:
return str(e)