Spaces:
Running
Running
Update app.py
Browse files
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(
|
26 |
return image
|
27 |
if isinstance(response, list):
|
28 |
image_data = response[0]['image']
|
29 |
-
image = Image.open(BytesIO(base64.b64decode(
|
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."
|