EnigmaOfTheWorld commited on
Commit
8d1595e
Β·
1 Parent(s): e2a97fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -66,21 +66,22 @@ def transform_ncuda(img,prompt,cfg=8.0,stps=30,sc=0.8):
66
 
67
  # Set up our warning to print to the console if the adult content classifier is tripped.
68
  # If adult content classifier is not tripped, display generated image.
69
- for resp in answers2:
70
- print('----------------------------------------------------------------------------------')
71
- print(f'{resp}')
72
- print(f'DEBUG: Type = {resp.__class__}')
73
- try:
 
74
  for artifact in resp.artifacts:
75
  if artifact.finish_reason == generation.FILTER:
76
  warnings.warn(
77
- "Your request activated the API's safety filters and could not be processed."
78
- "Please modify the prompt and try again.")
79
  if artifact.type == generation.ARTIFACT_IMAGE:
80
- global img2
81
- img2 = Image.open(io.BytesIO(artifact.binary))
82
- return img2
83
- except Exception as e:
84
  raise gr.Error("Input image from sketch")
85
  # print(f'Caught error: {e}')
86
  # logging.warn(f'Caught error: {e}')
 
66
 
67
  # Set up our warning to print to the console if the adult content classifier is tripped.
68
  # If adult content classifier is not tripped, display generated image.
69
+ try:
70
+ for resp in answers2:
71
+ print('----------------------------------------------------------------------------------')
72
+ print(f'{resp}')
73
+ print(f'DEBUG: Type = {resp.__class__}')
74
+
75
  for artifact in resp.artifacts:
76
  if artifact.finish_reason == generation.FILTER:
77
  warnings.warn(
78
+ "Your request activated the API's safety filters and could not be processed."
79
+ "Please modify the prompt and try again.")
80
  if artifact.type == generation.ARTIFACT_IMAGE:
81
+ global img2
82
+ img2 = Image.open(io.BytesIO(artifact.binary))
83
+ return img2
84
+ except Exception as e:
85
  raise gr.Error("Input image from sketch")
86
  # print(f'Caught error: {e}')
87
  # logging.warn(f'Caught error: {e}')