Spaces:
Runtime error
Runtime error
apolinario
commited on
Commit
•
483d89f
1
Parent(s):
48fa639
Bump version and small
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: ⚡
|
|
4 |
colorFrom: gray
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
4 |
colorFrom: gray
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.4b3
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
app.py
CHANGED
@@ -21,9 +21,6 @@ def download_image(url):
|
|
21 |
response = requests.get(url)
|
22 |
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
23 |
|
24 |
-
img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
|
25 |
-
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
|
26 |
-
|
27 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
28 |
pipe = StableDiffusionInpaintingPipeline.from_pretrained(
|
29 |
"CompVis/stable-diffusion-v1-4",
|
@@ -67,35 +64,17 @@ def predict(radio, dict, word_mask, prompt=""):
|
|
67 |
|
68 |
# examples = [[dict(image="init_image.png", mask="mask_image.png"), "A panda sitting on a bench"]]
|
69 |
css = '''
|
|
|
70 |
#image_upload{min-height:400px}
|
71 |
#image_upload [data-testid="image"], #image_upload [data-testid="image"] > div{min-height: 400px}
|
72 |
#mask_radio .gr-form{background:transparent; border: none}
|
73 |
#word_mask{margin-top: .75em !important}
|
74 |
#word_mask textarea:disabled{opacity: 0.3}
|
75 |
-
.footer {
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
}
|
81 |
-
.footer>p {
|
82 |
-
font-size: .8rem;
|
83 |
-
display: inline-block;
|
84 |
-
padding: 0 10px;
|
85 |
-
transform: translateY(10px);
|
86 |
-
background: white;
|
87 |
-
}
|
88 |
-
.dark .footer {
|
89 |
-
border-color: #303030;
|
90 |
-
}
|
91 |
-
.dark .footer>p {
|
92 |
-
background: #0b0f19;
|
93 |
-
}
|
94 |
-
.acknowledgments h4{
|
95 |
-
margin: 1.25em 0 .25em 0;
|
96 |
-
font-weight: bold;
|
97 |
-
font-size: 115%;
|
98 |
-
}
|
99 |
#image_upload .touch-none{display: flex}
|
100 |
'''
|
101 |
def swap_word_mask(radio_option):
|
@@ -181,7 +160,7 @@ with image_blocks as demo:
|
|
181 |
gr.HTML(
|
182 |
"""
|
183 |
<div class="footer">
|
184 |
-
<p>Model by <a href="https://huggingface.co/CompVis" style="text-decoration: underline;" target="_blank">CompVis</a> and <a href="https://huggingface.co/stabilityai" style="text-decoration: underline;" target="_blank">Stability AI</a> - Inpainting by nagolinc and patil-suraj
|
185 |
</p>
|
186 |
</div>
|
187 |
<div class="acknowledgments">
|
|
|
21 |
response = requests.get(url)
|
22 |
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
23 |
|
|
|
|
|
|
|
24 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
25 |
pipe = StableDiffusionInpaintingPipeline.from_pretrained(
|
26 |
"CompVis/stable-diffusion-v1-4",
|
|
|
64 |
|
65 |
# examples = [[dict(image="init_image.png", mask="mask_image.png"), "A panda sitting on a bench"]]
|
66 |
css = '''
|
67 |
+
.container {max-width: 730px;margin: auto;padding-top: 1.5rem}
|
68 |
#image_upload{min-height:400px}
|
69 |
#image_upload [data-testid="image"], #image_upload [data-testid="image"] > div{min-height: 400px}
|
70 |
#mask_radio .gr-form{background:transparent; border: none}
|
71 |
#word_mask{margin-top: .75em !important}
|
72 |
#word_mask textarea:disabled{opacity: 0.3}
|
73 |
+
.footer {margin-bottom: 45px;margin-top: 35px;text-align: center;border-bottom: 1px solid #e5e5e5}
|
74 |
+
.footer>p {font-size: .8rem; display: inline-block; padding: 0 10px;transform: translateY(10px);background: white}
|
75 |
+
.dark .footer {border-color: #303030}
|
76 |
+
.dark .footer>p {background: #0b0f19}
|
77 |
+
.acknowledgments h4{margin: 1.25em 0 .25em 0;font-weight: bold;font-size: 115%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
#image_upload .touch-none{display: flex}
|
79 |
'''
|
80 |
def swap_word_mask(radio_option):
|
|
|
160 |
gr.HTML(
|
161 |
"""
|
162 |
<div class="footer">
|
163 |
+
<p>Model by <a href="https://huggingface.co/CompVis" style="text-decoration: underline;" target="_blank">CompVis</a> and <a href="https://huggingface.co/stabilityai" style="text-decoration: underline;" target="_blank">Stability AI</a> - Inpainting by <a href="https://github.com/nagolinc" style="text-decoration: underline;" target="_blank">nagolinc</a> and <a href="https://github.com/patil-suraj">patil-suraj</a>, inpainting with words by <a href="https://twitter.com/yvrjsharma/" style="text-decoration: underline;" target="_blank">@yvrjsharma</a> and <a href="https://twitter.com/1littlecoder">@1littlecoder</a> - Gradio Demo by 🤗 Hugging Face
|
164 |
</p>
|
165 |
</div>
|
166 |
<div class="acknowledgments">
|