Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,11 +14,14 @@ llm = LlamaCpp(
|
|
| 14 |
)
|
| 15 |
|
| 16 |
# Generator function
|
| 17 |
-
def gen_quiz(
|
| 18 |
prompt = ChatPromptTemplate.from_template(
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
chain = LLMChain(llm=llm, prompt=prompt)
|
| 21 |
-
quiz = chain
|
| 22 |
return quiz['text']
|
| 23 |
|
| 24 |
# Example
|
|
|
|
| 14 |
)
|
| 15 |
|
| 16 |
# Generator function
|
| 17 |
+
def gen_quiz(text_input,num):
|
| 18 |
prompt = ChatPromptTemplate.from_template(
|
| 19 |
+
"Generate {num} questions and their correct answers based on the following text:\n\n{text}\n\n"
|
| 20 |
+
)
|
| 21 |
+
# Prepare the inputs for the chain
|
| 22 |
+
prompt_input = {"text": text_input, "num": num}
|
| 23 |
chain = LLMChain(llm=llm, prompt=prompt)
|
| 24 |
+
quiz = chain(prompt_input)
|
| 25 |
return quiz['text']
|
| 26 |
|
| 27 |
# Example
|