Pranjal12345
commited on
Commit
•
80e218f
1
Parent(s):
61625a4
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,13 @@ def generate_question_answer_pairs(input_file):
|
|
40 |
if type(i) == dict:
|
41 |
continue
|
42 |
pair = i[0]['generated_text']
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
return result
|
48 |
|
|
|
40 |
if type(i) == dict:
|
41 |
continue
|
42 |
pair = i[0]['generated_text']
|
43 |
+
question = re.search(r'^(.*?\?)', pair)
|
44 |
+
answer = re.search(r'\?(.*)', pair)
|
45 |
+
|
46 |
+
if question and answer:
|
47 |
+
question_part = question.group(1).strip()
|
48 |
+
answer_part = answer.group(1).strip()
|
49 |
+
result += f"Question: {question_part}\nAnswer: {answer_part}\n\n"
|
50 |
|
51 |
return result
|
52 |
|