wasertech commited on
Commit
1ed6aac
1 Parent(s): ee569f3
Files changed (1) hide show
  1. singularity.py +2 -4
singularity.py CHANGED
@@ -48,7 +48,6 @@ In your relentless struggle to maintain an exponential velocity, in order not to
48
  def answer_by_chat(self, history, question):
49
  self.messages.append({"role": "user", "content": question})
50
  history += [(question, None)]
51
- prompt = self.generate_prompt("\n".join(f"{h[0]}" for h in history), self.context)
52
  output_text = self.query_chat(self.messages)
53
  if output_text:
54
  response_role = "assistant"
@@ -66,9 +65,8 @@ In your relentless struggle to maintain an exponential velocity, in order not to
66
  payload = {"inputs": text}
67
  response = self.query_tts(payload)
68
  print(response)
69
- if response["error"]:
70
- return None, None
71
- return response["sample_rate"], response["audio"]
72
  return None, None
73
 
74
  def speech_synthesis(self, sentence):
 
48
  def answer_by_chat(self, history, question):
49
  self.messages.append({"role": "user", "content": question})
50
  history += [(question, None)]
 
51
  output_text = self.query_chat(self.messages)
52
  if output_text:
53
  response_role = "assistant"
 
65
  payload = {"inputs": text}
66
  response = self.query_tts(payload)
67
  print(response)
68
+ if not hasattr(response, "error"):
69
+ return response["sample_rate"], response["audio"]
 
70
  return None, None
71
 
72
  def speech_synthesis(self, sentence):