NihalGazi commited on
Commit
3930741
·
verified ·
1 Parent(s): b111b48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import random
3
  import requests
4
  import gradio as gr
 
5
  from io import BytesIO
6
 
7
  def generate_image(prompt, width, height, seed, randomize):
@@ -17,7 +18,11 @@ def generate_image(prompt, width, height, seed, randomize):
17
  .replace("[seed]", str(seed))
18
  )
19
  response = requests.get(url)
20
- return BytesIO(response.content)
 
 
 
 
21
 
22
  title = "Unlimited FLUX-Pro"
23
  description = "Here you can use the FLUX-Pro as much as you want without limits"
 
2
  import random
3
  import requests
4
  import gradio as gr
5
+ from PIL import Image
6
  from io import BytesIO
7
 
8
  def generate_image(prompt, width, height, seed, randomize):
 
18
  .replace("[seed]", str(seed))
19
  )
20
  response = requests.get(url)
21
+ if response.status_code == 200:
22
+ image = Image.open(BytesIO(response.content))
23
+ return image
24
+ else:
25
+ return "Failed to retrieve image."
26
 
27
  title = "Unlimited FLUX-Pro"
28
  description = "Here you can use the FLUX-Pro as much as you want without limits"