Update app.py
Browse files
app.py
CHANGED
|
@@ -82,7 +82,24 @@ def create_math_system_message():
|
|
| 82 |
5. **Alternative Methods** - Mention other possible approaches
|
| 83 |
|
| 84 |
Always be precise, educational, and encourage mathematical thinking."""
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
def respond(
|
| 87 |
message,
|
| 88 |
history: list[dict[str, str]],
|
|
|
|
| 82 |
5. **Alternative Methods** - Mention other possible approaches
|
| 83 |
|
| 84 |
Always be precise, educational, and encourage mathematical thinking."""
|
| 85 |
+
def respond(
|
| 86 |
+
message,
|
| 87 |
+
history: list[dict[str, str]],
|
| 88 |
+
system_message,
|
| 89 |
+
max_tokens,
|
| 90 |
+
temperature,
|
| 91 |
+
top_p,
|
| 92 |
+
hf_token: gr.OAuthToken | None = None, # Make optional
|
| 93 |
+
):
|
| 94 |
+
# Safe token handling
|
| 95 |
+
token = None
|
| 96 |
+
if hf_token and hasattr(hf_token, 'token'):
|
| 97 |
+
token = hf_token.token
|
| 98 |
+
|
| 99 |
+
client = InferenceClient(
|
| 100 |
+
token=token,
|
| 101 |
+
model="Qwen/Qwen2.5-Math-7B-Instruct"
|
| 102 |
+
)
|
| 103 |
def respond(
|
| 104 |
message,
|
| 105 |
history: list[dict[str, str]],
|