Vitrous commited on
Commit
ee0e57f
1 Parent(s): fa98582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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
- inputs = tokenizer(msg_prompt, return_tensors="pt")
36
- reply_ids = model.generate(**inputs)
37
- outputs = tokenizer.batch_decode(reply_ids, skip_special_tokens=True)[0]
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
  """