KaiChen1998 commited on
Commit
f158243
·
verified ·
1 Parent(s): 96c3b7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -293,9 +293,9 @@ def http_bot(state, temperature, top_p, max_new_tokens, speaker):
293
  output += "}"
294
  info_dict = json.loads(output)
295
  content_unit = info_dict['assistant response speech'].replace('<|speech_', '').replace('|>', ' ').strip()
296
- emotion = info_dict['assistant response emotion'] if hasattr(info_dict, 'assistant response emotion') else "neutral"
297
- speed = info_dict['assistant response speed'] if hasattr(info_dict, 'assistant response speed') else "normal"
298
- pitch = info_dict['assistant response pitch'] if hasattr(info_dict, 'assistant response pitch') else "normal"
299
  gender = speaker.lower() if speaker else 'female'
300
  except:
301
  content_unit = output.replace('<|speech_', '').replace('|>', ' ').strip()
 
293
  output += "}"
294
  info_dict = json.loads(output)
295
  content_unit = info_dict['assistant response speech'].replace('<|speech_', '').replace('|>', ' ').strip()
296
+ emotion = info_dict['assistant response emotion'] if 'assistant response emotion' in info_dict else "neutral"
297
+ speed = info_dict['assistant response speed'] if 'assistant response speed' in info_dict else "normal"
298
+ pitch = info_dict['assistant response pitch'] if 'assistant response pitch' in info_dict else "normal"
299
  gender = speaker.lower() if speaker else 'female'
300
  except:
301
  content_unit = output.replace('<|speech_', '').replace('|>', ' ').strip()