Update app.py
Browse files
app.py
CHANGED
|
@@ -6,19 +6,19 @@ client = InferenceClient(
|
|
| 6 |
)
|
| 7 |
def answer(question):
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 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()
|