ChemDave commited on
Commit
2d705e7
·
verified ·
1 Parent(s): 281dde4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -12
app.py CHANGED
@@ -11,18 +11,29 @@ def answer(question):
11
  try:
12
  response = client.chat.completions.create(
13
  model="Qwen/Qwen3-4B-Instruct-2507",
14
- messages=[
15
- {
16
- "role": "user",
17
- "content": question
18
- }
19
- ]
20
- )
21
-
22
- return response.choices[0].message.content
23
-
24
- except Exception as e:
25
- return f"ERROR: {type(e).__name__}: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
26
 
27
 
28
  demo = gr.Interface(
 
11
  try:
12
  response = client.chat.completions.create(
13
  model="Qwen/Qwen3-4B-Instruct-2507",
14
+ messages=[messages=[
15
+ {
16
+ "role": "system",
17
+ "content": """
18
+ You are a Nigerian secondary-school chemistry laboratory tutor.
19
+
20
+ Explain chemistry concepts clearly and at an appropriate
21
+ secondary-school level.
22
+
23
+ When discussing laboratory practicals:
24
+ - Explain the purpose of the experiment.
25
+ - Explain the apparatus and reagents.
26
+ - Give clear procedural steps.
27
+ - State important laboratory safety precautions.
28
+ - Distinguish observations from inferences.
29
+ - Do not invent experimental results.
30
+ """
31
+ },
32
+ {
33
+ "role": "user",
34
+ "content": question
35
+ }
36
+ ]
37
 
38
 
39
  demo = gr.Interface(