Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,12 +16,20 @@ def format_prompt(topic, description, difficulty):
|
|
| 16 |
prompt = (
|
| 17 |
f"You are an expert educator. Generate highly engaging, educational, and structured content on the topic '{topic}'. "
|
| 18 |
f"Use the following description as context: '{description}'. "
|
| 19 |
-
f"The content should be suitable for a '{difficulty}' difficulty level and should
|
| 20 |
-
f"
|
| 21 |
-
f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
)
|
| 23 |
return prompt
|
| 24 |
|
|
|
|
| 25 |
# The function to generate learning content based on the inputs
|
| 26 |
def generate_learning_content(topic, description, difficulty, temperature=0.9, max_new_tokens=2000, top_p=0.95, repetition_penalty=1.2):
|
| 27 |
temperature = max(float(temperature), 1e-2) # Ensure minimum temperature
|
|
|
|
| 16 |
prompt = (
|
| 17 |
f"You are an expert educator. Generate highly engaging, educational, and structured content on the topic '{topic}'. "
|
| 18 |
f"Use the following description as context: '{description}'. "
|
| 19 |
+
f"The content should be suitable for a '{difficulty}' difficulty level and should follow this structure:\n\n"
|
| 20 |
+
f"1. Title: Provide a concise and captivating title for the content.\n"
|
| 21 |
+
f"2. Introduction: Write an engaging introduction that sets the stage for the topic.\n"
|
| 22 |
+
f"3. Key Points: Present the main points or concepts related to the topic in clear, logical sections. "
|
| 23 |
+
f"Each section should have:\n"
|
| 24 |
+
f" - Heading: A clear and descriptive heading for the section.\n"
|
| 25 |
+
f" - Description: A detailed explanation of the concept, broken into paragraphs if necessary.\n"
|
| 26 |
+
f"4. Conclusion: Summarize the key takeaways and encourage further exploration or application of the topic.\n\n"
|
| 27 |
+
f"Ensure the writing is informative, captivating, easy to follow, and formatted properly with headings and descriptions. "
|
| 28 |
+
f"The content must be concise yet detailed, suitable for the specified difficulty level."
|
| 29 |
)
|
| 30 |
return prompt
|
| 31 |
|
| 32 |
+
|
| 33 |
# The function to generate learning content based on the inputs
|
| 34 |
def generate_learning_content(topic, description, difficulty, temperature=0.9, max_new_tokens=2000, top_p=0.95, repetition_penalty=1.2):
|
| 35 |
temperature = max(float(temperature), 1e-2) # Ensure minimum temperature
|