Spaces:
Running
Running
mrfakename
commited on
Commit
•
8e14d20
1
Parent(s):
5863b44
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
|
|
3 |
from datasets import load_dataset
|
4 |
import threading, time, uuid, sqlite3, shutil, os, random, asyncio, threading
|
5 |
from pathlib import Path
|
@@ -529,6 +530,12 @@ def synthandreturn(text):
|
|
529 |
raise gr.Error('Your text failed the toxicity test')
|
530 |
if not text:
|
531 |
raise gr.Error(f'You did not enter any text')
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
# Get two random models
|
533 |
mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
|
534 |
log_text(text)
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
+
from langdetect import detect
|
4 |
from datasets import load_dataset
|
5 |
import threading, time, uuid, sqlite3, shutil, os, random, asyncio, threading
|
6 |
from pathlib import Path
|
|
|
530 |
raise gr.Error('Your text failed the toxicity test')
|
531 |
if not text:
|
532 |
raise gr.Error(f'You did not enter any text')
|
533 |
+
# Check language
|
534 |
+
try:
|
535 |
+
if not detect(text) == "en":
|
536 |
+
gr.Warning('Warning: The inputted text may not be English')
|
537 |
+
except:
|
538 |
+
pass
|
539 |
# Get two random models
|
540 |
mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
|
541 |
log_text(text)
|