Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
remove deepmoji restrictions
Browse files- app.py +2 -2
- resources/app/plugins/deepmoji_plugin/sentiment.py +24 -13
app.py
CHANGED
@@ -215,8 +215,8 @@ pacing_slider = gr.Slider(0.5, 2.0, value=1.0, step=0.1, label="Duration")
|
|
215 |
pitch_slider = gr.Slider(0, 1.0, value=0.5, step=0.05, label="Pitch", visible=False)
|
216 |
energy_slider = gr.Slider(0.1, 1.0, value=1.0, step=0.05, label="Energy", visible=False)
|
217 |
anger_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ Anger")
|
218 |
-
happy_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐
|
219 |
-
sad_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ญ
|
220 |
surprise_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ฎ Surprise")
|
221 |
voice_radio = gr.Radio(
|
222 |
voice_models,
|
|
|
215 |
pitch_slider = gr.Slider(0, 1.0, value=0.5, step=0.05, label="Pitch", visible=False)
|
216 |
energy_slider = gr.Slider(0.1, 1.0, value=1.0, step=0.05, label="Energy", visible=False)
|
217 |
anger_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ Anger")
|
218 |
+
happy_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ Happiness")
|
219 |
+
sad_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ญ Sadness")
|
220 |
surprise_slider = gr.Slider(0, 1.0, value=0, step=0.05, label="๐ฎ Surprise")
|
221 |
voice_radio = gr.Radio(
|
222 |
voice_models,
|
resources/app/plugins/deepmoji_plugin/sentiment.py
CHANGED
@@ -224,34 +224,41 @@ def adjust_values(data=None):
|
|
224 |
em_angry_max = 0.6
|
225 |
try:
|
226 |
em_angry += float(data["pluginsContext"]["mantella_settings"]["emAngry"]) * 100
|
|
|
227 |
except:
|
228 |
pass
|
229 |
try:
|
230 |
em_happy += float(data["pluginsContext"]["mantella_settings"]["emHappy"]) * 100
|
|
|
231 |
except:
|
232 |
pass
|
233 |
try:
|
234 |
em_sad += float(data["pluginsContext"]["mantella_settings"]["emSad"]) * 100
|
|
|
235 |
except:
|
236 |
pass
|
237 |
try:
|
238 |
em_surprise += float(data["pluginsContext"]["mantella_settings"]["emSurprise"]) * 100
|
|
|
239 |
except:
|
240 |
pass
|
241 |
|
242 |
-
#
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
255 |
logger.log(f'Amplifier ratio: {ratio}')
|
256 |
hasExcMark = False
|
257 |
if ('!!!' in text_scores[0]):
|
@@ -276,6 +283,10 @@ def adjust_values(data=None):
|
|
276 |
logger.log(f'! Ratio: {ratio}')
|
277 |
hasExcMark = True
|
278 |
|
|
|
|
|
|
|
|
|
279 |
# final values
|
280 |
em_angry = min(em_angry_max, em_angry / 100 * ratio) if em_angry > 0 else 0
|
281 |
em_happy = min(em_emotion_max, em_happy / 100 * ratio) if em_happy > 0 else 0
|
|
|
224 |
em_angry_max = 0.6
|
225 |
try:
|
226 |
em_angry += float(data["pluginsContext"]["mantella_settings"]["emAngry"]) * 100
|
227 |
+
em_angry_max = 1
|
228 |
except:
|
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 |
|
246 |
+
# HF
|
247 |
+
if (len(text_scores) > 1):
|
248 |
+
# top_em highest wins all
|
249 |
+
top_em = max(
|
250 |
+
em_angry,
|
251 |
+
em_happy,
|
252 |
+
em_sad
|
253 |
+
)
|
254 |
+
em_angry = em_angry if (em_angry == top_em) else 0
|
255 |
+
em_happy = em_happy if (em_happy == top_em) else 0
|
256 |
+
# amplified sadness ratio
|
257 |
+
em_sad = (em_sad * 3) if (em_sad == top_em) else 0
|
258 |
+
|
259 |
+
# amplifier
|
260 |
+
ratio = float(plugin_settings['amplifier_ratio'])
|
261 |
+
|
262 |
logger.log(f'Amplifier ratio: {ratio}')
|
263 |
hasExcMark = False
|
264 |
if ('!!!' in text_scores[0]):
|
|
|
283 |
logger.log(f'! Ratio: {ratio}')
|
284 |
hasExcMark = True
|
285 |
|
286 |
+
# HF
|
287 |
+
if (len(text_scores) <= 1):
|
288 |
+
ratio = 1
|
289 |
+
|
290 |
# final values
|
291 |
em_angry = min(em_angry_max, em_angry / 100 * ratio) if em_angry > 0 else 0
|
292 |
em_happy = min(em_emotion_max, em_happy / 100 * ratio) if em_happy > 0 else 0
|