Pendrokar commited on
Commit
a6dc01d
β€’
1 Parent(s): 5c1072f

gr_client response fix

Browse files
Files changed (1) hide show
  1. gr_client.py +20 -16
gr_client.py CHANGED
@@ -99,7 +99,7 @@ def predict(
99
  surprise,
100
  deepmoji_checked
101
  ):
102
- wav_path, response = client.predict(
103
  input_text, # str in 'Input Text' Textbox component
104
  voice, # Literal['ccby_nvidia_hifi_6670_M', 'ccby_nv_hifi_11614_F', 'ccby_nvidia_hifi_11697_F', 'ccby_nvidia_hifi_12787_F', 'ccby_nvidia_hifi_6097_M', 'ccby_nvidia_hifi_6671_M', 'ccby_nvidia_hifi_8051_F', 'ccby_nvidia_hifi_9017_M', 'ccby_nvidia_hifi_9136_F', 'ccby_nvidia_hifi_92_F'] in 'Voice' Radio component
105
  lang, # Literal['en', 'de', 'es', 'it', 'fr', 'ru', 'tr', 'la', 'ro', 'da', 'vi', 'ha', 'nl', 'zh', 'ar', 'uk', 'hi', 'ko', 'pl', 'sw', 'fi', 'hu', 'pt', 'yo', 'sv', 'el', 'wo', 'jp'] in 'Language' Radio component
@@ -114,27 +114,31 @@ def predict(
114
  api_name="/predict"
115
  )
116
 
117
- json_data = json.loads(response)
118
 
119
- arpabet_html = '<h6>ARPAbet & Durations</h6>'
120
- arpabet_symbols = json_data['arpabet'].split('|')
121
- for symb_i in range(len(json_data['durations'])):
122
- if (arpabet_symbols[symb_i] == '<PAD>'):
123
- continue
124
 
125
- arpabet_html += '<strong class="arpabet" style="padding: 0 '\
126
- + str(round(float(json_data['durations'][symb_i]/2), 1))\
127
- +'em">'\
128
- + arpabet_symbols[symb_i]\
129
- + '</strong> '
130
 
131
  return [
132
  wav_path,
133
  arpabet_html,
134
- round(json_data['em_angry'][0], 2),
135
- round(json_data['em_happy'][0], 2),
136
- round(json_data['em_sad'][0], 2),
137
- round(json_data['em_surprise'][0], 2)
 
 
 
 
138
  ]
139
 
140
  input_textbox = gr.Textbox(
 
99
  surprise,
100
  deepmoji_checked
101
  ):
102
+ wav_path, arpabet_html, angry, happy, sad, surprise = client.predict(
103
  input_text, # str in 'Input Text' Textbox component
104
  voice, # Literal['ccby_nvidia_hifi_6670_M', 'ccby_nv_hifi_11614_F', 'ccby_nvidia_hifi_11697_F', 'ccby_nvidia_hifi_12787_F', 'ccby_nvidia_hifi_6097_M', 'ccby_nvidia_hifi_6671_M', 'ccby_nvidia_hifi_8051_F', 'ccby_nvidia_hifi_9017_M', 'ccby_nvidia_hifi_9136_F', 'ccby_nvidia_hifi_92_F'] in 'Voice' Radio component
105
  lang, # Literal['en', 'de', 'es', 'it', 'fr', 'ru', 'tr', 'la', 'ro', 'da', 'vi', 'ha', 'nl', 'zh', 'ar', 'uk', 'hi', 'ko', 'pl', 'sw', 'fi', 'hu', 'pt', 'yo', 'sv', 'el', 'wo', 'jp'] in 'Language' Radio component
 
114
  api_name="/predict"
115
  )
116
 
117
+ # json_data = json.loads(response)
118
 
119
+ # arpabet_html = '<h6>ARPAbet & Durations</h6>'
120
+ # arpabet_symbols = json_data['arpabet'].split('|')
121
+ # for symb_i in range(len(json_data['durations'])):
122
+ # if (arpabet_symbols[symb_i] == '<PAD>'):
123
+ # continue
124
 
125
+ # arpabet_html += '<strong class="arpabet" style="padding: 0 '\
126
+ # + str(round(float(json_data['durations'][symb_i]/2), 1))\
127
+ # +'em">'\
128
+ # + arpabet_symbols[symb_i]\
129
+ # + '</strong> '
130
 
131
  return [
132
  wav_path,
133
  arpabet_html,
134
+ angry,
135
+ happy,
136
+ sad,
137
+ surprise,
138
+ # round(json_data['em_angry'][0], 2),
139
+ # round(json_data['em_happy'][0], 2),
140
+ # round(json_data['em_sad'][0], 2),
141
+ # round(json_data['em_surprise'][0], 2)
142
  ]
143
 
144
  input_textbox = gr.Textbox(