broadfield-dev commited on
Commit
82cbfc3
·
verified ·
1 Parent(s): c1f5900

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -21,12 +21,12 @@ models = [
21
  def generate_image(prompt, model_name):
22
  client = InferenceClient(model_name)
23
  response = client.text_to_image(prompt)
24
- image_data = response[0]['image']
25
- image = Image.open(BytesIO(base64.b64decode(image_data)))
26
  return image
27
  if isinstance(response, list):
28
  image_data = response[0]['image']
29
- image = Image.open(BytesIO(base64.b64decode(image_data)))
30
  return image
31
  else:
32
  return "Failed to generate image."
 
21
  def generate_image(prompt, model_name):
22
  client = InferenceClient(model_name)
23
  response = client.text_to_image(prompt)
24
+ #image_data = response[0]['image']
25
+ image = Image.open(BytesIO(base64.b64decode(response)))
26
  return image
27
  if isinstance(response, list):
28
  image_data = response[0]['image']
29
+ image = Image.open(BytesIO(base64.b64decode(response)))
30
  return image
31
  else:
32
  return "Failed to generate image."