Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,11 @@ model = genai.GenerativeModel('gemini-pro')
|
|
12 |
|
13 |
def get_coding_exercise(topic, difficulty):
|
14 |
"""Generate a coding exercise based on the given topic and difficulty."""
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
try:
|
17 |
response = model.generate_content(prompt)
|
18 |
return response.text
|
|
|
12 |
|
13 |
def get_coding_exercise(topic, difficulty):
|
14 |
"""Generate a coding exercise based on the given topic and difficulty."""
|
15 |
+
|
16 |
+
prompt = f"""Create a {difficulty} Python coding exercise about {topic}.
|
17 |
+
Provide ONLY the problem statement and expected output.
|
18 |
+
Do NOT include any code or solution.
|
19 |
+
Keep it under 100 words and make it clear and concise."""
|
20 |
try:
|
21 |
response = model.generate_content(prompt)
|
22 |
return response.text
|