Update functions.py
Browse files- functions.py +3 -4
functions.py
CHANGED
|
@@ -499,7 +499,7 @@ def generate_eval(raw_text, N, chunk):
|
|
| 499 |
# raw_text = ','.join(raw_text)
|
| 500 |
|
| 501 |
update = st.empty()
|
| 502 |
-
|
| 503 |
update.info("`Generating sample questions ...`")
|
| 504 |
n = len(raw_text)
|
| 505 |
starting_indices = [random.randint(0, n-chunk) for _ in range(N)]
|
|
@@ -507,15 +507,14 @@ def generate_eval(raw_text, N, chunk):
|
|
| 507 |
chain = QAGenerationChain.from_llm(ChatOpenAI(temperature=0))
|
| 508 |
eval_set = []
|
| 509 |
for i, b in enumerate(sub_sequences):
|
| 510 |
-
ques_update
|
| 511 |
qa = chain.run(b)
|
| 512 |
eval_set.append(qa)
|
| 513 |
-
ques_update.info(f"Creating Question:{i+1}")
|
| 514 |
|
| 515 |
eval_set_full = list(itertools.chain.from_iterable(eval_set))
|
| 516 |
|
| 517 |
update.empty()
|
| 518 |
-
ques_update.empty()
|
| 519 |
|
| 520 |
return eval_set_full
|
| 521 |
|
|
|
|
| 499 |
# raw_text = ','.join(raw_text)
|
| 500 |
|
| 501 |
update = st.empty()
|
| 502 |
+
ques_update = st.empty()
|
| 503 |
update.info("`Generating sample questions ...`")
|
| 504 |
n = len(raw_text)
|
| 505 |
starting_indices = [random.randint(0, n-chunk) for _ in range(N)]
|
|
|
|
| 507 |
chain = QAGenerationChain.from_llm(ChatOpenAI(temperature=0))
|
| 508 |
eval_set = []
|
| 509 |
for i, b in enumerate(sub_sequences):
|
| 510 |
+
ques_update.empty()
|
| 511 |
qa = chain.run(b)
|
| 512 |
eval_set.append(qa)
|
| 513 |
+
ques_update.info(f"Creating Question: {i+1}")
|
| 514 |
|
| 515 |
eval_set_full = list(itertools.chain.from_iterable(eval_set))
|
| 516 |
|
| 517 |
update.empty()
|
|
|
|
| 518 |
|
| 519 |
return eval_set_full
|
| 520 |
|