generated from qqpann/python_chatgpt_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
32 lines (25 loc) · 829 Bytes
/
run.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
import pandas as pd
from tqdm import tqdm
from model import chat
LIM = 10
def main():
df = pd.DataFrame(columns=["question", "ai_answer", "modified_answer"])
with open("data/aituber_question_dataset/question.txt", "r") as f:
for i, line in enumerate(tqdm(f.readlines()), start=1):
line = line.strip()
question = line
ai_answer = chat(line)
modified_answer = ""
df = df._append(
{
"question": question,
"ai_answer": ai_answer,
"modified_answer": modified_answer,
},
ignore_index=True,
)
if i >= LIM:
break
df.to_csv(f"out/question_answer.csv", index=False)
if __name__ == "__main__":
main()