Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,8 +19,8 @@ print (loaded_model)
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
-
def run_dif_color(out_prompt,model_drop,cnt,color):
|
| 23 |
-
|
| 24 |
p_seed=""
|
| 25 |
out_box=[]
|
| 26 |
out_html=""
|
|
@@ -35,7 +35,7 @@ def run_dif_color(out_prompt,model_drop,cnt,color):
|
|
| 35 |
raw=Image.open(out_img)
|
| 36 |
raw=raw.convert('RGB')
|
| 37 |
|
| 38 |
-
colorize = RGBTransform().mix_with(
|
| 39 |
|
| 40 |
out_box.append(colorize)
|
| 41 |
except Exception as e:
|
|
@@ -158,13 +158,17 @@ min-width:200px;
|
|
| 158 |
"""
|
| 159 |
with gr.Blocks(css=css) as app:
|
| 160 |
with gr.Row():
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
with gr.Row():
|
| 165 |
model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
|
| 166 |
cnt = gr.Number(value=1)
|
| 167 |
out_html=gr.HTML()
|
| 168 |
outp=gr.Gallery()
|
| 169 |
-
btn.click(run_dif_color,[inp,model_drop,cnt],[outp,out_html])
|
| 170 |
app.launch()
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
+
def run_dif_color(out_prompt,model_drop,cnt,color,tint):
|
| 23 |
+
print (color)
|
| 24 |
p_seed=""
|
| 25 |
out_box=[]
|
| 26 |
out_html=""
|
|
|
|
| 35 |
raw=Image.open(out_img)
|
| 36 |
raw=raw.convert('RGB')
|
| 37 |
|
| 38 |
+
colorize = RGBTransform().mix_with(color,factor=float(tint)).applied_to(raw)
|
| 39 |
|
| 40 |
out_box.append(colorize)
|
| 41 |
except Exception as e:
|
|
|
|
| 158 |
"""
|
| 159 |
with gr.Blocks(css=css) as app:
|
| 160 |
with gr.Row():
|
| 161 |
+
with gr.Column():
|
| 162 |
+
inp=gr.Textbox(label="Prompt")
|
| 163 |
+
btn=gr.Button()
|
| 164 |
+
with gr.Column():
|
| 165 |
+
col = gr.ColorPicker(label="Color Tint")
|
| 166 |
+
tint = gr.Slider(label="Tint Strength", minimum=0, maximum=1, step=0.01, value=0.30)
|
| 167 |
|
| 168 |
with gr.Row():
|
| 169 |
model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
|
| 170 |
cnt = gr.Number(value=1)
|
| 171 |
out_html=gr.HTML()
|
| 172 |
outp=gr.Gallery()
|
| 173 |
+
btn.click(run_dif_color,[inp,model_drop,cnt,col,tint],[outp,out_html])
|
| 174 |
app.launch()
|