Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -86,35 +86,42 @@ def generate_images(prompt, img_filepath,
|
|
86 |
return [images[0], Image.fromarray(face_image[..., [2, 1, 0]])]
|
87 |
|
88 |
|
89 |
-
with gr.Blocks() as demo:
|
90 |
gr.Markdown(
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
97 |
with gr.Row():
|
98 |
with gr.Column():
|
99 |
demo_inputs = []
|
100 |
-
demo_inputs.append(gr.Textbox(label='
|
101 |
-
demo_inputs.append(gr.Image(type='filepath', label='image
|
102 |
-
|
103 |
-
|
104 |
-
demo_inputs.append(gr.
|
|
|
|
|
105 |
btn = gr.Button("Generate")
|
106 |
|
107 |
with gr.Column():
|
108 |
demo_outputs = []
|
109 |
-
demo_outputs.append(gr.Image(label='generated
|
110 |
-
demo_outputs.append(gr.Image(label='
|
|
|
111 |
btn.click(generate_images, inputs=demo_inputs, outputs=demo_outputs)
|
|
|
112 |
sample_prompts = [
|
113 |
'Linkedin profile picture',
|
114 |
'A singer on stage',
|
115 |
'A politician talking to the people',
|
116 |
'An astronaut in space',
|
117 |
-
|
118 |
-
gr.Examples(sample_prompts, inputs=demo_inputs[0], label='Sample
|
119 |
|
120 |
-
demo.launch(share=True, debug=True)
|
|
|
86 |
return [images[0], Image.fromarray(face_image[..., [2, 1, 0]])]
|
87 |
|
88 |
|
89 |
+
with gr.Blocks(css=".title { color: #4CAF50; font-family: 'Trebuchet MS', Helvetica, sans-serif; }") as demo:
|
90 |
gr.Markdown(
|
91 |
+
"""
|
92 |
+
<div class="title">
|
93 |
+
# IP-Adapter-FaceID-plus
|
94 |
+
</div>
|
95 |
+
Generate images conditioned on an image prompt and a text prompt. Learn more here: [IP-Adapter-FaceID](https://huggingface.co/h94/IP-Adapter-FaceID).
|
96 |
+
|
97 |
+
This demo is intended to use on GPU. It will work also on CPU but generating one image could take 900 seconds compared to a few seconds on GPU.
|
98 |
+
""")
|
99 |
+
|
100 |
with gr.Row():
|
101 |
with gr.Column():
|
102 |
demo_inputs = []
|
103 |
+
demo_inputs.append(gr.Textbox(label='Text Prompt', value='Linkedin profile picture', placeholder="Enter a description for the image you want to generate", info="e.g., A professional profile picture, A singer on stage"))
|
104 |
+
demo_inputs.append(gr.Image(type='filepath', label='Image Prompt', source="upload", tool="editor", info="Upload an image to guide the generation"))
|
105 |
+
|
106 |
+
with gr.Accordion(label='Advanced Options', open=False):
|
107 |
+
demo_inputs.append(gr.Textbox(label='Negative Text Prompt', value="monochrome, lowres, bad anatomy, worst quality, low quality, blurry", placeholder="Enter aspects to avoid in the generated image", info="e.g., blurry, low quality"))
|
108 |
+
demo_inputs.append(gr.Slider(maximum=1, minimum=0, value=0.5, step=0.05, label='Image Prompt Scale', info="Adjust the influence of the image prompt"))
|
109 |
+
|
110 |
btn = gr.Button("Generate")
|
111 |
|
112 |
with gr.Column():
|
113 |
demo_outputs = []
|
114 |
+
demo_outputs.append(gr.Image(label='Generated Image', elem_id="generated-image"))
|
115 |
+
demo_outputs.append(gr.Image(label='Detected Face', height=224, width=224, elem_id="detected-face"))
|
116 |
+
|
117 |
btn.click(generate_images, inputs=demo_inputs, outputs=demo_outputs)
|
118 |
+
|
119 |
sample_prompts = [
|
120 |
'Linkedin profile picture',
|
121 |
'A singer on stage',
|
122 |
'A politician talking to the people',
|
123 |
'An astronaut in space',
|
124 |
+
]
|
125 |
+
gr.Examples(sample_prompts, inputs=demo_inputs[0], label='Sample Prompts')
|
126 |
|
127 |
+
demo.launch(share=True, debug=True)
|