Spaces:
Sleeping
Sleeping
Commit
·
e84336d
1
Parent(s):
017db32
fix generation code
Browse files
app.py
CHANGED
|
@@ -33,6 +33,8 @@ stability_api = client.StabilityInference(
|
|
| 33 |
verbose=True
|
| 34 |
)
|
| 35 |
|
|
|
|
|
|
|
| 36 |
from PIL import Image
|
| 37 |
import warnings
|
| 38 |
import random
|
|
@@ -58,7 +60,7 @@ def inferAndRebuild(image, mode):
|
|
| 58 |
imglist = []
|
| 59 |
for resp in answers:
|
| 60 |
for artifact in resp.artifacts:
|
| 61 |
-
if artifact.finish_reason ==
|
| 62 |
warnings.warn(
|
| 63 |
"Your request activated the API's safety filters and could not be processed. Please modify the prompt and try again.")
|
| 64 |
if artifact.type == generation.ARTIFACT_IMAGE:
|
|
|
|
| 33 |
verbose=True
|
| 34 |
)
|
| 35 |
|
| 36 |
+
import clip
|
| 37 |
+
import torch
|
| 38 |
from PIL import Image
|
| 39 |
import warnings
|
| 40 |
import random
|
|
|
|
| 60 |
imglist = []
|
| 61 |
for resp in answers:
|
| 62 |
for artifact in resp.artifacts:
|
| 63 |
+
if artifact.finish_reason == generation.FILTER:
|
| 64 |
warnings.warn(
|
| 65 |
"Your request activated the API's safety filters and could not be processed. Please modify the prompt and try again.")
|
| 66 |
if artifact.type == generation.ARTIFACT_IMAGE:
|