Pendrokar commited on
Commit
6115840
β€’
1 Parent(s): 270258a

run_deepmoji

Browse files
.gitattributes CHANGED
@@ -37,3 +37,4 @@ resources/app/python/xvapitch/text/dicts/german.txt filter=lfs diff=lfs merge=lf
37
  resources/app/python/xvapitch/text/dicts/arabic.txt filter=lfs diff=lfs merge=lfs -text
38
  resources/app/python/xvapitch/text/dicts/russian.txt filter=lfs diff=lfs merge=lfs -text
39
  resources/app/python/xvapitch/text/dicts/spanish.txt filter=lfs diff=lfs merge=lfs -text
 
 
37
  resources/app/python/xvapitch/text/dicts/arabic.txt filter=lfs diff=lfs merge=lfs -text
38
  resources/app/python/xvapitch/text/dicts/russian.txt filter=lfs diff=lfs merge=lfs -text
39
  resources/app/python/xvapitch/text/dicts/spanish.txt filter=lfs diff=lfs merge=lfs -text
40
+ resources/app/plugins/deepmoji_plugin/DeepMoji/text_unidecode/dicts/data.bin filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -163,7 +163,8 @@ def predict(
163
  anger,
164
  happy,
165
  sad,
166
- surprise
 
167
  ):
168
  # grab only the first 1000 characters
169
  input_text = input_text[:1000]
@@ -184,9 +185,11 @@ def predict(
184
  "emAngry": (anger if anger > 0 else 0),
185
  "emHappy": (happy if happy > 0 else 0),
186
  "emSad": (sad if sad > 0 else 0),
187
- "emSurprise": (surprise if surprise > 0 else 0)
 
188
  }
189
 
 
190
  data = {
191
  'pluginsContext': json.dumps(pluginsContext),
192
  'modelType': model_type,
@@ -256,6 +259,7 @@ language_radio = gr.Radio(
256
  info="Will be more monotone and have an English accent. Tested mostly by a native Briton."
257
  )
258
  # language_radio.change(set_default_text)
 
259
 
260
  gradio_app = gr.Interface(
261
  predict,
@@ -269,7 +273,8 @@ gradio_app = gr.Interface(
269
  anger_slider,
270
  happy_slider,
271
  sad_slider,
272
- surprise_slider
 
273
  ],
274
  outputs=[
275
  gr.Audio(label="22kHz audio output", type="filepath"),
 
163
  anger,
164
  happy,
165
  sad,
166
+ surprise,
167
+ use_deepmoji
168
  ):
169
  # grab only the first 1000 characters
170
  input_text = input_text[:1000]
 
185
  "emAngry": (anger if anger > 0 else 0),
186
  "emHappy": (happy if happy > 0 else 0),
187
  "emSad": (sad if sad > 0 else 0),
188
+ "emSurprise": (surprise if surprise > 0 else 0),
189
+ "run_model": use_deepmoji
190
  }
191
 
192
+
193
  data = {
194
  'pluginsContext': json.dumps(pluginsContext),
195
  'modelType': model_type,
 
259
  info="Will be more monotone and have an English accent. Tested mostly by a native Briton."
260
  )
261
  # language_radio.change(set_default_text)
262
+ deepmoji_checkbox = gr.Checkbox(label="Use DeepMoji", info="Auto adjust emotional values")
263
 
264
  gradio_app = gr.Interface(
265
  predict,
 
273
  anger_slider,
274
  happy_slider,
275
  sad_slider,
276
+ surprise_slider,
277
+ deepmoji_checkbox
278
  ],
279
  outputs=[
280
  gr.Audio(label="22kHz audio output", type="filepath"),
resources/app/plugins/deepmoji_plugin/sentiment.py CHANGED
@@ -36,7 +36,7 @@ last_em_surprise = float(0)
36
 
37
  def scoreText(text):
38
  return text
39
- # from plugins.deepmoji_plugin.xvasynth_torchmoji import scoreText
40
  import csv
41
 
42
  def setup(data=None):
@@ -88,6 +88,7 @@ def fetch_text(data=None):
88
  if (
89
  plugin_settings["load_deepmoji_model"]=="false"
90
  or plugin_settings["load_deepmoji_model"]==False
 
91
  ):
92
  logger.log("DeepMoji model skipped")
93
  return
@@ -229,17 +230,14 @@ def adjust_values(data=None):
229
  pass
230
  try:
231
  em_happy += float(data["pluginsContext"]["mantella_settings"]["emHappy"]) * 100
232
- em_emotion_max = 1
233
  except:
234
  pass
235
  try:
236
  em_sad += float(data["pluginsContext"]["mantella_settings"]["emSad"]) * 100
237
- em_emotion_max = 1
238
  except:
239
  pass
240
  try:
241
  em_surprise += float(data["pluginsContext"]["mantella_settings"]["emSurprise"]) * 100
242
- em_emotion_max = 1
243
  except:
244
  pass
245
 
@@ -260,6 +258,8 @@ def adjust_values(data=None):
260
  ratio = float(plugin_settings['amplifier_ratio'])
261
  else:
262
  ratio = 1.0
 
 
263
 
264
  logger.log(f'Amplifier ratio: {ratio}')
265
  hasExcMark = False
 
36
 
37
  def scoreText(text):
38
  return text
39
+ from plugins.deepmoji_plugin.xvasynth_torchmoji import scoreText
40
  import csv
41
 
42
  def setup(data=None):
 
88
  if (
89
  plugin_settings["load_deepmoji_model"]=="false"
90
  or plugin_settings["load_deepmoji_model"]==False
91
+ or data["pluginsContext"]["mantella_settings"]["run_model"]==False
92
  ):
93
  logger.log("DeepMoji model skipped")
94
  return
 
230
  pass
231
  try:
232
  em_happy += float(data["pluginsContext"]["mantella_settings"]["emHappy"]) * 100
 
233
  except:
234
  pass
235
  try:
236
  em_sad += float(data["pluginsContext"]["mantella_settings"]["emSad"]) * 100
 
237
  except:
238
  pass
239
  try:
240
  em_surprise += float(data["pluginsContext"]["mantella_settings"]["emSurprise"]) * 100
 
241
  except:
242
  pass
243
 
 
258
  ratio = float(plugin_settings['amplifier_ratio'])
259
  else:
260
  ratio = 1.0
261
+ em_emotion_max = 1
262
+ em_angry_max = 1
263
 
264
  logger.log(f'Amplifier ratio: {ratio}')
265
  hasExcMark = False