Spaces:
Running on Zero
Running on Zero
odi commited on
Commit ·
29f1069
1
Parent(s): aa6554b
UPDATE
Browse files
app.py
CHANGED
|
@@ -8,9 +8,12 @@ def generate_image(prompt, style_id):
|
|
| 8 |
try:
|
| 9 |
styles = Somnium.Styles()
|
| 10 |
image = Somnium.Generate(prompt, styles[style_id])
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
except Exception as e:
|
| 13 |
-
raise gr.Error("Process failed
|
| 14 |
|
| 15 |
# create interface
|
| 16 |
iface = gr.Interface(
|
|
|
|
| 8 |
try:
|
| 9 |
styles = Somnium.Styles()
|
| 10 |
image = Somnium.Generate(prompt, styles[style_id])
|
| 11 |
+
if image == None:
|
| 12 |
+
raise gr.Error("Process contains NSFW")
|
| 13 |
+
else:
|
| 14 |
+
return image
|
| 15 |
except Exception as e:
|
| 16 |
+
raise gr.Error("Process failed")
|
| 17 |
|
| 18 |
# create interface
|
| 19 |
iface = gr.Interface(
|