Spaces:
Sleeping
Sleeping
SunderAli17
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,13 @@ from PIL import Image
|
|
18 |
from insightface.app import FaceAnalysis
|
19 |
from insightface.data import get_image as ins_get_image
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
device = "cuda"
|
23 |
ckpt_dir = snapshot_download(repo_id="SunderAli17/SAK")
|
@@ -119,8 +126,8 @@ def infer(prompt,
|
|
119 |
|
120 |
|
121 |
examples = [
|
122 |
-
["wearing a full suit sitting in a restaurant with candle lights
|
123 |
-
|
124 |
]
|
125 |
|
126 |
|
@@ -143,8 +150,21 @@ def load_description(fp):
|
|
143 |
content = f.read()
|
144 |
return content
|
145 |
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
with gr.Row():
|
149 |
with gr.Column(elem_id="col-left"):
|
150 |
with gr.Row():
|
@@ -195,7 +215,7 @@ with gr.Blocks(css=css) as SAK:
|
|
195 |
gr.Examples(
|
196 |
fn = infer,
|
197 |
examples = examples,
|
198 |
-
inputs = [
|
199 |
outputs = [result, seed_used],
|
200 |
)
|
201 |
|
|
|
18 |
from insightface.app import FaceAnalysis
|
19 |
from insightface.data import get_image as ins_get_image
|
20 |
|
21 |
+
MARKDOWN = """
|
22 |
+
This demo utilizes <a href="https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_xl">Stable Diffusion XL Pipeline</a>
|
23 |
+
|
24 |
+
Try out with different prompts using your image and do provide your feedback.
|
25 |
+
|
26 |
+
**Demo by [Sunder Ali Khowaja](https://sander-ali.github.io) - [X](https://x.com/SunderAKhowaja) -[Github](https://github.com/sander-ali) -[Hugging Face](https://huggingface.co/SunderAli17)**
|
27 |
+
"""
|
28 |
|
29 |
device = "cuda"
|
30 |
ckpt_dir = snapshot_download(repo_id="SunderAli17/SAK")
|
|
|
126 |
|
127 |
|
128 |
examples = [
|
129 |
+
["image/SunderAli_Khowaja.png", "wearing a full suit sitting in a restaurant with candle lights"],
|
130 |
+
["image/test2.jpg", "Wild cowboy hat with western town and horses in the background"]
|
131 |
]
|
132 |
|
133 |
|
|
|
150 |
content = f.read()
|
151 |
return content
|
152 |
|
153 |
+
theme = gr.themes.Soft(
|
154 |
+
font=[gr.themes.GoogleFont('Source Code Pro'), gr.themes.GoogleFont('Public Sans'), 'system-ui', 'sans-serif'],
|
155 |
+
)
|
156 |
+
js_func = """
|
157 |
+
function refresh() {
|
158 |
+
const url = new URL(window.location);
|
159 |
+
if (url.searchParams.get('__theme') !== 'dark') {
|
160 |
+
url.searchParams.set('__theme', 'dark');
|
161 |
+
window.location.href = url.href;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
"""
|
165 |
+
|
166 |
+
with gr.Blocks(js = js_func, theme = theme) as SAK:
|
167 |
+
gr.Markdown(MARKDOWN)
|
168 |
with gr.Row():
|
169 |
with gr.Column(elem_id="col-left"):
|
170 |
with gr.Row():
|
|
|
215 |
gr.Examples(
|
216 |
fn = infer,
|
217 |
examples = examples,
|
218 |
+
inputs = [image, prompt],
|
219 |
outputs = [result, seed_used],
|
220 |
)
|
221 |
|