ImagineAI-Real commited on
Commit
8f35dfd
·
1 Parent(s): a0b5962

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -17,17 +17,14 @@ def generate_image(prompt, seed=0, negative_prompt="", model="Deliberate", sampl
17
  "steps": steps
18
  }
19
  response = requests.post(api_url, data=data)
20
- if response.status_code == 200:
21
- # Decode the base64 image string
22
- img_bytes = base64.b64decode(response.json()["url"])
23
-
24
- # Open the image using Pillow
25
- img = Image.open(io.BytesIO(img_bytes))
26
-
27
- # Return the image object
28
- return img
29
- else:
30
- return None
31
 
32
  inputs = [
33
  gr.inputs.Textbox(label="Prompt"),
 
17
  "steps": steps
18
  }
19
  response = requests.post(api_url, data=data)
20
+ # Decode the base64 image string
21
+ img_bytes = base64.b64decode(response.json()["url"])
22
+
23
+ # Open the image using Pillow
24
+ img = Image.open(io.BytesIO(img_bytes))
25
+
26
+ # Return the image object
27
+ return img
 
 
 
28
 
29
  inputs = [
30
  gr.inputs.Textbox(label="Prompt"),