Skip to content

Commit

Permalink
add: output response to csv
Browse files Browse the repository at this point in the history
  • Loading branch information
qqpann committed Jul 22, 2023
1 parent ac73e14 commit f2fa1b0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ cython_debug/
#.idea/

models/*
out/*
!.gitkeep
Empty file added out/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mypy
openai
pylint
python-dotenv
pandas
22 changes: 19 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
import pandas as pd
from tqdm import tqdm

from model import chat

DEBUG = True


def main():
df = pd.DataFrame(columns=["question", "ai_answer", "modified_answer"])
with open("data/aituber_question_dataset/question.txt", "r") as f:
for line in f.readlines():
print("question >", line)
print("ai answer >", chat(line))
for line in tqdm(f.readlines()):
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 DEBUG:
break
df.to_csv(f"out/question_answer.csv", index=False)


if __name__ == "__main__":
Expand Down

0 comments on commit f2fa1b0

Please sign in to comment.