reach-vb HF staff commited on
Commit
8f8bb42
1 Parent(s): 2987626
Files changed (1) hide show
  1. app.py +2 -2
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.5):
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 inputted text may not be English')
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