Spaces:
Sleeping
Sleeping
Update pipelines.py
Browse files- pipelines.py +4 -6
pipelines.py
CHANGED
|
@@ -18,10 +18,9 @@ import os
|
|
| 18 |
HUGGINGFACE_API_KEY = os.getenv('HUGGINGFACE_API_KEY')
|
| 19 |
|
| 20 |
# Define your quiz generation template
|
| 21 |
-
quiz_generation_template =
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
"content": """Given the following text, create only 4 multiple-choice or true-false questions in JSON format randomly.
|
| 25 |
The options should be unambiguous.
|
| 26 |
For multiple-choice questions, each option should begin with a letter followed by a period and a space (e.g., "a. option").
|
| 27 |
For true-false questions, there should be only two options that is ('true','false').
|
|
@@ -41,9 +40,8 @@ Example JSON format you should absolutely follow:
|
|
| 41 |
IMPORTANT: Do not write anything else and stop generating after once!!!
|
| 42 |
text:
|
| 43 |
{% for doc in documents %}{{ doc.content|truncate(3800) }}{% endfor %}
|
|
|
|
| 44 |
"""
|
| 45 |
-
}
|
| 46 |
-
]
|
| 47 |
|
| 48 |
|
| 49 |
def generate_quiz_pipeline():
|
|
|
|
| 18 |
HUGGINGFACE_API_KEY = os.getenv('HUGGINGFACE_API_KEY')
|
| 19 |
|
| 20 |
# Define your quiz generation template
|
| 21 |
+
quiz_generation_template = """
|
| 22 |
+
{% message role="user" %}
|
| 23 |
+
Given the following text, create only 4 multiple-choice or true-false questions in JSON format randomly.
|
|
|
|
| 24 |
The options should be unambiguous.
|
| 25 |
For multiple-choice questions, each option should begin with a letter followed by a period and a space (e.g., "a. option").
|
| 26 |
For true-false questions, there should be only two options that is ('true','false').
|
|
|
|
| 40 |
IMPORTANT: Do not write anything else and stop generating after once!!!
|
| 41 |
text:
|
| 42 |
{% for doc in documents %}{{ doc.content|truncate(3800) }}{% endfor %}
|
| 43 |
+
{% endmessage %}
|
| 44 |
"""
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
def generate_quiz_pipeline():
|