Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
#17
by
reach-vb
HF staff
- opened
app.py
CHANGED
@@ -527,7 +527,7 @@ def synthandreturn(text):
|
|
527 |
raise gr.Error(f'You exceeded the limit of {MAX_SAMPLE_TXT_LENGTH} characters')
|
528 |
if len(text) < MIN_SAMPLE_TXT_LENGTH:
|
529 |
raise gr.Error(f'Please input a text longer than {MIN_SAMPLE_TXT_LENGTH} characters')
|
530 |
-
if (toxicity.predict(text)['toxicity'] > 0.
|
531 |
print(f'Detected toxic content! "{text}"')
|
532 |
raise gr.Error('Your text failed the toxicity test')
|
533 |
if not text:
|
@@ -535,7 +535,7 @@ def synthandreturn(text):
|
|
535 |
# Check language
|
536 |
try:
|
537 |
if not detect(text) == "en":
|
538 |
-
gr.Warning('Warning: The
|
539 |
except:
|
540 |
pass
|
541 |
# Get two random models
|
|
|
527 |
raise gr.Error(f'You exceeded the limit of {MAX_SAMPLE_TXT_LENGTH} characters')
|
528 |
if len(text) < MIN_SAMPLE_TXT_LENGTH:
|
529 |
raise gr.Error(f'Please input a text longer than {MIN_SAMPLE_TXT_LENGTH} characters')
|
530 |
+
if (toxicity.predict(text)['toxicity'] > 0.8):
|
531 |
print(f'Detected toxic content! "{text}"')
|
532 |
raise gr.Error('Your text failed the toxicity test')
|
533 |
if not text:
|
|
|
535 |
# Check language
|
536 |
try:
|
537 |
if not detect(text) == "en":
|
538 |
+
gr.Warning('Warning: The input text may not be in English')
|
539 |
except:
|
540 |
pass
|
541 |
# Get two random models
|