Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,14 +32,15 @@ def blender_model():
|
|
| 32 |
model, tokenizer = blender_model()
|
| 33 |
|
| 34 |
def chat_response(msg_prompt: str) -> str:
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
return outputs
|
| 40 |
except Exception as e:
|
| 41 |
return str(e)
|
| 42 |
|
|
|
|
| 43 |
# Function to generate a response from the model
|
| 44 |
def chat_responses(msg_prompt: str) -> str:
|
| 45 |
"""
|
|
|
|
| 32 |
model, tokenizer = blender_model()
|
| 33 |
|
| 34 |
def chat_response(msg_prompt: str) -> str:
|
| 35 |
+
try:
|
| 36 |
+
inputs = tokenizer(msg_prompt, return_tensors="pt")
|
| 37 |
+
reply_ids = model.generate(**inputs)
|
| 38 |
+
outputs = tokenizer.batch_decode(reply_ids, skip_special_tokens=True)[0]
|
| 39 |
return outputs
|
| 40 |
except Exception as e:
|
| 41 |
return str(e)
|
| 42 |
|
| 43 |
+
|
| 44 |
# Function to generate a response from the model
|
| 45 |
def chat_responses(msg_prompt: str) -> str:
|
| 46 |
"""
|