nyanko7 commited on
Commit
56611b9
1 Parent(s): 9fe5ebe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -17,14 +17,6 @@ auth_token = os.getenv("auth_token")
17
  logging.basicConfig(level=logging.INFO)
18
  logger = logging.getLogger(__name__)
19
 
20
- def download_image_from_url(url):
21
- response = requests.get(url)
22
- img = Image.open(BytesIO(response.content))
23
- tmp = tempfile.NamedTemporaryFile(delete=False)
24
- img.save(tmp, 'PNG')
25
- tmp.close()
26
- return tmp.name
27
-
28
  def fetch_image(url):
29
  try:
30
  response = requests.get(url)
@@ -78,7 +70,7 @@ def niji_api(prompt):
78
  time.sleep(1)
79
  # Process the final image urls
80
  image_urls = data['response']['imageUrls']
81
- yield [(download_image_from_url(iurl), f"image {idx}/4") for idx, iurl in enumerate(image_urls)]
82
 
83
  with gr.Blocks() as demo:
84
  gr.HTML('''
 
17
  logging.basicConfig(level=logging.INFO)
18
  logger = logging.getLogger(__name__)
19
 
 
 
 
 
 
 
 
 
20
  def fetch_image(url):
21
  try:
22
  response = requests.get(url)
 
70
  time.sleep(1)
71
  # Process the final image urls
72
  image_urls = data['response']['imageUrls']
73
+ yield [(iurl, f"image {idx}/4") for idx, iurl in enumerate(image_urls)]
74
 
75
  with gr.Blocks() as demo:
76
  gr.HTML('''