ChemDave commited on
Commit
7abbc78
·
verified ·
1 Parent(s): 1d3d441

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -6,19 +6,19 @@ client = InferenceClient(
6
  )
7
  def answer(question):
8
 
9
- response = client.chat.completions.create(
10
- model="Qwen/Qwen3-4B-Instruct-2507",
11
- messages = [
12
- {"role": "user",
13
- "content":"question"
14
- }
15
- ]
16
- )
17
- return response.choices[0].message.content
18
- demo = gr.Interface(
19
- fn=answer,
20
- inputs=gr.Textbox(label="Ask a chemistry question"),
21
- outputs=gr.Textbox(label="AI Response"),
22
- title="VR-LAB"
23
- )
24
  demo.launch()
 
6
  )
7
  def answer(question):
8
 
9
+ try:
10
+ response = client.chat.completions.create(
11
+ model="Qwen/Qwen3-4B-Instruct-2507",
12
+ messages=[
13
+ {
14
+ "role": "user",
15
+ "content": question
16
+ }
17
+ ]
18
+ )
19
+
20
+ return response.choices[0].message.content
21
+
22
+ except Exception as e:
23
+ return f"ERROR: {type(e).__name__}: {str(e)}"
24
  demo.launch()