Spaces:
Runtime error
Runtime error
mrfakename
commited on
Commit
•
510b5a1
1
Parent(s):
eaddc8c
Update app.py
Browse files
app.py
CHANGED
@@ -34,10 +34,11 @@ def generate_text(text, temperature, maxLen):
|
|
34 |
toks = 0
|
35 |
for out in streamer:
|
36 |
toks += 1
|
37 |
-
if toks
|
38 |
toks = 0
|
39 |
if mdl.predict(t)['toxicity'] > 0.7:
|
40 |
raise gr.Error("Sorry, our systems may have detected toxic content. Please try a different input.")
|
|
|
41 |
t += out
|
42 |
yield t
|
43 |
with gr.Blocks(css="footer{display:none !important}", theme=theme) as demo:
|
|
|
34 |
toks = 0
|
35 |
for out in streamer:
|
36 |
toks += 1
|
37 |
+
if toks >= 3:
|
38 |
toks = 0
|
39 |
if mdl.predict(t)['toxicity'] > 0.7:
|
40 |
raise gr.Error("Sorry, our systems may have detected toxic content. Please try a different input.")
|
41 |
+
break
|
42 |
t += out
|
43 |
yield t
|
44 |
with gr.Blocks(css="footer{display:none !important}", theme=theme) as demo:
|