EnigmaOfTheWorld commited on
Commit
9e41e67
β€’
1 Parent(s): 664f55d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -19,6 +19,7 @@ from base64 import b64encode
19
  from pathlib import Path
20
  import openai
21
  import logging
 
22
 
23
  try:
24
  import face_recognition
@@ -190,8 +191,10 @@ openai.api_key = os.environ['OPENAI_KEY']
190
  PROMPT = "colorful portrait 25 year bespectacled woman with long, curly skyblue hair and bright green eyes. She has a small, upturned nose and a freckled complexion. She is approximately 5'5 tall and has a thin build"
191
  def generate(PROMPT,model):
192
  # PROMPT = "An eco-friendly computer from the 90s in the style of vaporwave""Dall-E","StableDiffusion"
193
-
194
- img = generate_stability(PROMPT)
 
 
195
  return np.asarray(img)
196
 
197
 
 
19
  from pathlib import Path
20
  import openai
21
  import logging
22
+ import grpc
23
 
24
  try:
25
  import face_recognition
 
191
  PROMPT = "colorful portrait 25 year bespectacled woman with long, curly skyblue hair and bright green eyes. She has a small, upturned nose and a freckled complexion. She is approximately 5'5 tall and has a thin build"
192
  def generate(PROMPT,model):
193
  # PROMPT = "An eco-friendly computer from the 90s in the style of vaporwave""Dall-E","StableDiffusion"
194
+ try:
195
+ img = generate_stability(PROMPT)
196
+ except grpc._channel._MultiThreadedRendezvous:
197
+ raise gr.Error("Invalid prompts detected")
198
  return np.asarray(img)
199
 
200