Spaces:
Sleeping
Sleeping
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -413,7 +413,7 @@ def main():
|
|
413 |
|
414 |
# providing the rules for the answers to be generated
|
415 |
additional_rules = """
|
416 |
-
|
417 |
"""
|
418 |
|
419 |
question = st.session_state["selected_items"]
|
@@ -442,12 +442,15 @@ def main():
|
|
442 |
print("\n\n\n\n\nAnswerss before regex\n\n\n\n")
|
443 |
print(content)
|
444 |
# print("Answer Type:" + str(type(content)))
|
445 |
-
responses_list = content.split('\n')
|
446 |
# print("\n\n\n\n\nAnswerss before regex after splitting\n\n\n\n")
|
447 |
# print(responses_list)
|
448 |
# print("Answer Type:" + str(type(responses_list)))
|
449 |
|
450 |
-
responses_list = [re.sub(r'^\s*\d+\.\s*', '', resp) for resp in responses_list if resp]
|
|
|
|
|
|
|
451 |
st.session_state["answers"]=responses_list
|
452 |
st.session_state.answered = True
|
453 |
st.session_state.Initial2 = False
|
|
|
413 |
|
414 |
# providing the rules for the answers to be generated
|
415 |
additional_rules = """
|
416 |
+
Each generated answer should be within the <ans>Answer</ans> tag and the question should be within the <ques>Question</ques> tag.
|
417 |
"""
|
418 |
|
419 |
question = st.session_state["selected_items"]
|
|
|
442 |
print("\n\n\n\n\nAnswerss before regex\n\n\n\n")
|
443 |
print(content)
|
444 |
# print("Answer Type:" + str(type(content)))
|
445 |
+
# responses_list = content.split('\n')
|
446 |
# print("\n\n\n\n\nAnswerss before regex after splitting\n\n\n\n")
|
447 |
# print(responses_list)
|
448 |
# print("Answer Type:" + str(type(responses_list)))
|
449 |
|
450 |
+
# responses_list = [re.sub(r'^\s*\d+\.\s*', '', resp) for resp in responses_list if resp]
|
451 |
+
responses_list = re.findall(r'<ans>(.*?)</ans>', content, re.DOTALL)
|
452 |
+
|
453 |
+
|
454 |
st.session_state["answers"]=responses_list
|
455 |
st.session_state.answered = True
|
456 |
st.session_state.Initial2 = False
|