Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,12 +10,12 @@ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
|
| 10 |
|
| 11 |
# Chat function with prompt-based filtering
|
| 12 |
def chat(instruction):
|
| 13 |
-
prompt =
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
If the question is not related to Python, respond with:
|
| 17 |
"Sorry, I can only answer Python-related questions."
|
| 18 |
|
|
|
|
| 19 |
### Instruction:
|
| 20 |
{instruction}
|
| 21 |
|
|
|
|
| 10 |
|
| 11 |
# Chat function with prompt-based filtering
|
| 12 |
def chat(instruction):
|
| 13 |
+
prompt = f"""You are a helpful and expert Python programming tutor.
|
| 14 |
+
Only answer questions related to Python programming.
|
| 15 |
+
If the question is unrelated to Python, respond with:
|
|
|
|
| 16 |
"Sorry, I can only answer Python-related questions."
|
| 17 |
|
| 18 |
+
Answer the following instruction with a structured and informative format.
|
| 19 |
### Instruction:
|
| 20 |
{instruction}
|
| 21 |
|