Spaces:
Sleeping
Sleeping
Nitzantry1
commited on
Commit
โข
b4ab413
1
Parent(s):
eff6cb5
Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,11 @@ generator = InferenceApi(repo_id=model_id, token=api_key)
|
|
11 |
# ืคืื ืงืฆืืืช ืืฆืืจืช ืืืงืกื
|
12 |
def chat_with_model(history):
|
13 |
prompt = history[-1]["content"]
|
14 |
-
|
15 |
-
|
16 |
-
"
|
17 |
-
|
18 |
-
"
|
19 |
-
"top_p": 0.92,
|
20 |
-
"temperature": 0.9
|
21 |
-
})
|
22 |
-
result = response["generated_text"]
|
23 |
return history + [{"role": "bot", "content": result}]
|
24 |
|
25 |
# ืืฆืืจืช ืืืฉืง ืืชืงืื ืขื Gradio ืืฆืืจืช ืฆ'ื-ืืื ืืกืื ืื ืืงืืื
|
|
|
11 |
# ืคืื ืงืฆืืืช ืืฆืืจืช ืืืงืกื
|
12 |
def chat_with_model(history):
|
13 |
prompt = history[-1]["content"]
|
14 |
+
try:
|
15 |
+
response = generator(prompt)
|
16 |
+
result = response["generated_text"] if "generated_text" in response else response
|
17 |
+
except Exception as e:
|
18 |
+
result = f"Error: {str(e)}"
|
|
|
|
|
|
|
|
|
19 |
return history + [{"role": "bot", "content": result}]
|
20 |
|
21 |
# ืืฆืืจืช ืืืฉืง ืืชืงืื ืขื Gradio ืืฆืืจืช ืฆ'ื-ืืื ืืกืื ืื ืืงืืื
|