Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import sys
|
|
4 |
from pathlib import Path
|
5 |
from PIL import Image
|
6 |
import re
|
|
|
|
|
7 |
|
8 |
# Coder: Create directories if they don't exist
|
9 |
if not os.path.exists('saved_prompts'):
|
@@ -137,12 +139,18 @@ with gr.Blocks(css=css) as myface:
|
|
137 |
with gr.Column(scale=100):
|
138 |
magic1=gr.Textbox(lines=4)
|
139 |
run=gr.Button("Generate Image")
|
|
|
140 |
with gr.Row():
|
141 |
with gr.Column(scale=100):
|
142 |
model_name1 = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index", value=current_model, interactive=True)
|
|
|
143 |
with gr.Row():
|
144 |
with gr.Column(style="width=800px"):
|
145 |
output1=gr.Image(label=(f"{current_model}"))
|
|
|
|
|
|
|
|
|
146 |
|
147 |
with gr.Row():
|
148 |
with gr.Column(scale=50):
|
|
|
4 |
from pathlib import Path
|
5 |
from PIL import Image
|
6 |
import re
|
7 |
+
from PIL import Image
|
8 |
+
import numpy as np
|
9 |
|
10 |
# Coder: Create directories if they don't exist
|
11 |
if not os.path.exists('saved_prompts'):
|
|
|
139 |
with gr.Column(scale=100):
|
140 |
magic1=gr.Textbox(lines=4)
|
141 |
run=gr.Button("Generate Image")
|
142 |
+
|
143 |
with gr.Row():
|
144 |
with gr.Column(scale=100):
|
145 |
model_name1 = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index", value=current_model, interactive=True)
|
146 |
+
|
147 |
with gr.Row():
|
148 |
with gr.Column(style="width=800px"):
|
149 |
output1=gr.Image(label=(f"{current_model}"))
|
150 |
+
if isinstance(output1, str):
|
151 |
+
print(f"Warning: output1 is a string, not an array. Value: {output1}")
|
152 |
+
else:
|
153 |
+
Image.fromarray(np.array(output1, dtype=np.uint8)).save(image_path)
|
154 |
|
155 |
with gr.Row():
|
156 |
with gr.Column(scale=50):
|