zhangjf commited on
Commit
4199bb2
1 Parent(s): 09fe09b

update existing qas.json

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -37,11 +37,8 @@ def num_tokens_from_messages(messages, model="gpt-3.5-turbo"):
37
  See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens.""")
38
 
39
 
40
- qas = []
41
- qs = []
42
- start_time = time.time()
43
-
44
- def read_qs(qs, qas):
45
  directory = "./dialogues_set"
46
  filenames = [
47
  'dialogues_film.json',
@@ -74,7 +71,10 @@ def read_qs(qs, qas):
74
  print(f"filter out {len(qs)-len(remained_qs)} with reference to qas.json")
75
  qs = remained_qs
76
 
77
- return qs
 
 
 
78
 
79
 
80
  def ask(query, max_attempt_times=3):
@@ -102,7 +102,6 @@ def ask(query, max_attempt_times=3):
102
 
103
 
104
  def askingChatGPT(qs, qas, min_interval_seconds=10):
105
- read_qs(qs, qas)
106
 
107
  for i, q in enumerate(qs):
108
  ask_start_time = time.time()
 
37
  See https://github.com/openai/openai-python/blob/main/chatml.md for information on how messages are converted to tokens.""")
38
 
39
 
40
+ def read_qs():
41
+ qs, qas = [], []
 
 
 
42
  directory = "./dialogues_set"
43
  filenames = [
44
  'dialogues_film.json',
 
71
  print(f"filter out {len(qs)-len(remained_qs)} with reference to qas.json")
72
  qs = remained_qs
73
 
74
+ return qs, qas
75
+
76
+ qs, qas = read_qs()
77
+ start_time = time.time()
78
 
79
 
80
  def ask(query, max_attempt_times=3):
 
102
 
103
 
104
  def askingChatGPT(qs, qas, min_interval_seconds=10):
 
105
 
106
  for i, q in enumerate(qs):
107
  ask_start_time = time.time()