Spaces:
Runtime error
Runtime error
update instructions
Browse files
app.py
CHANGED
|
@@ -25,15 +25,13 @@ from datetime import datetime
|
|
| 25 |
|
| 26 |
from climategan_wrapper import ClimateGAN
|
| 27 |
|
| 28 |
-
|
| 29 |
dedent(
|
| 30 |
"""
|
| 31 |
<p>
|
| 32 |
Climate change does not impact everyone equally.
|
| 33 |
This Space shows the effects of the climate emergency,
|
| 34 |
"one address at a time".
|
| 35 |
-
</p>
|
| 36 |
-
<p>
|
| 37 |
Visit the original experience at
|
| 38 |
<a href="https://thisclimatedoesnotexist.com/">
|
| 39 |
ThisClimateDoesNotExist.com
|
|
@@ -47,27 +45,14 @@ HTMLS = [
|
|
| 47 |
</p>
|
| 48 |
<br>
|
| 49 |
<p>
|
| 50 |
-
This is <strong>
|
| 51 |
-
rather an exercise of empathy, to put yourself in
|
| 52 |
as if Climate Change came crushing on your doorstep.
|
| 53 |
</p>
|
| 54 |
"""
|
| 55 |
),
|
| 56 |
dedent(
|
| 57 |
"""
|
| 58 |
-
<br><br><br><br>
|
| 59 |
-
<p style='text-align: center'>
|
| 60 |
-
Visit
|
| 61 |
-
<a href='https://thisclimatedoesnotexist.com/'>
|
| 62 |
-
ThisClimateDoesNotExist.com
|
| 63 |
-
</a>
|
| 64 |
-
for more information
|
| 65 |
-
|
|
| 66 |
-
Original
|
| 67 |
-
<a href='https://github.com/cc-ai/climategan'>
|
| 68 |
-
ClimateGAN GitHub Repo
|
| 69 |
-
</a>
|
| 70 |
-
</p>
|
| 71 |
<br>
|
| 72 |
<p>
|
| 73 |
After you have selected an image and started the inference you
|
|
@@ -82,8 +67,17 @@ HTMLS = [
|
|
| 82 |
select 'Both' painters, you will see a comparison
|
| 83 |
</p>
|
| 84 |
<br>
|
| 85 |
-
<
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
Read the original
|
| 88 |
<a
|
| 89 |
href='https://openreview.net/forum?id=EZNOb_uNpJk'
|
|
@@ -93,6 +87,25 @@ HTMLS = [
|
|
| 93 |
</p>
|
| 94 |
"""
|
| 95 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
]
|
| 97 |
CSS = dedent(
|
| 98 |
"""
|
|
@@ -102,6 +115,13 @@ CSS = dedent(
|
|
| 102 |
}
|
| 103 |
strong {
|
| 104 |
color: #c34318;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
}
|
| 106 |
"""
|
| 107 |
)
|
|
@@ -224,11 +244,12 @@ if __name__ == "__main__":
|
|
| 224 |
with Row():
|
| 225 |
with Column():
|
| 226 |
Markdown("# ClimateGAN: Visualize Climate Change")
|
| 227 |
-
HTML(
|
|
|
|
| 228 |
with Column():
|
| 229 |
-
|
| 230 |
with Row():
|
| 231 |
-
|
| 232 |
with Row():
|
| 233 |
with Column():
|
| 234 |
if api_key:
|
|
@@ -284,4 +305,4 @@ if __name__ == "__main__":
|
|
| 284 |
if api_key:
|
| 285 |
radio.change(toggle, inputs=[radio], outputs=[address, im_inp, btn])
|
| 286 |
|
| 287 |
-
app.launch()
|
|
|
|
| 25 |
|
| 26 |
from climategan_wrapper import ClimateGAN
|
| 27 |
|
| 28 |
+
TEXTS = [
|
| 29 |
dedent(
|
| 30 |
"""
|
| 31 |
<p>
|
| 32 |
Climate change does not impact everyone equally.
|
| 33 |
This Space shows the effects of the climate emergency,
|
| 34 |
"one address at a time".
|
|
|
|
|
|
|
| 35 |
Visit the original experience at
|
| 36 |
<a href="https://thisclimatedoesnotexist.com/">
|
| 37 |
ThisClimateDoesNotExist.com
|
|
|
|
| 45 |
</p>
|
| 46 |
<br>
|
| 47 |
<p>
|
| 48 |
+
This is <strong>NOT</strong> an exercise in climate prediction,
|
| 49 |
+
rather an exercise of empathy, to put yourself in others' shoes,
|
| 50 |
as if Climate Change came crushing on your doorstep.
|
| 51 |
</p>
|
| 52 |
"""
|
| 53 |
),
|
| 54 |
dedent(
|
| 55 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
<br>
|
| 57 |
<p>
|
| 58 |
After you have selected an image and started the inference you
|
|
|
|
| 67 |
select 'Both' painters, you will see a comparison
|
| 68 |
</p>
|
| 69 |
<br>
|
| 70 |
+
<p style='text-align: center'>
|
| 71 |
+
Visit
|
| 72 |
+
<a href='https://thisclimatedoesnotexist.com/'>
|
| 73 |
+
ThisClimateDoesNotExist.com</a>
|
| 74 |
+
for more information
|
| 75 |
+
|
|
| 76 |
+
Original
|
| 77 |
+
<a href='https://github.com/cc-ai/climategan'>
|
| 78 |
+
ClimateGAN GitHub Repo
|
| 79 |
+
</a>
|
| 80 |
+
|
|
| 81 |
Read the original
|
| 82 |
<a
|
| 83 |
href='https://openreview.net/forum?id=EZNOb_uNpJk'
|
|
|
|
| 87 |
</p>
|
| 88 |
"""
|
| 89 |
),
|
| 90 |
+
dedent(
|
| 91 |
+
"""
|
| 92 |
+
## How to use this Space
|
| 93 |
+
|
| 94 |
+
1. Enter an address or upload a Street View image
|
| 95 |
+
2. Select the type of Painter you'd like to use for the flood renderings
|
| 96 |
+
3. Click on the "See for yourself!" button
|
| 97 |
+
4. Wait for the inference to complete, typically around 30 seconds
|
| 98 |
+
(plus queue time)
|
| 99 |
+
5. Enjoy the results!
|
| 100 |
+
|
| 101 |
+
1. The prompt for Stable Diffusion is `An HD picture of a street with
|
| 102 |
+
dirty water after a heavy flood`
|
| 103 |
+
2. Pay attention to potential "inventions" by Stable Diffusion's in-painting
|
| 104 |
+
3. The "restricted to masked area" SD output is the result of:
|
| 105 |
+
`y = mask * flooded + (1-mask) * input`
|
| 106 |
+
|
| 107 |
+
"""
|
| 108 |
+
),
|
| 109 |
]
|
| 110 |
CSS = dedent(
|
| 111 |
"""
|
|
|
|
| 115 |
}
|
| 116 |
strong {
|
| 117 |
color: #c34318;
|
| 118 |
+
font-weight: bolder;
|
| 119 |
+
}
|
| 120 |
+
#how-to-use-md li {
|
| 121 |
+
margin: 0.1em;
|
| 122 |
+
}
|
| 123 |
+
#how-to-use-md li p {
|
| 124 |
+
margin: 0.1em;
|
| 125 |
}
|
| 126 |
"""
|
| 127 |
)
|
|
|
|
| 244 |
with Row():
|
| 245 |
with Column():
|
| 246 |
Markdown("# ClimateGAN: Visualize Climate Change")
|
| 247 |
+
HTML(TEXTS[0])
|
| 248 |
+
HTML(TEXTS[1])
|
| 249 |
with Column():
|
| 250 |
+
Markdown(TEXTS[2], elem_id="how-to-use-md")
|
| 251 |
with Row():
|
| 252 |
+
HTML("<hr><br><h2 style='font-size: 1.5rem;'>Choose Inputs</h2>")
|
| 253 |
with Row():
|
| 254 |
with Column():
|
| 255 |
if api_key:
|
|
|
|
| 305 |
if api_key:
|
| 306 |
radio.change(toggle, inputs=[radio], outputs=[address, im_inp, btn])
|
| 307 |
|
| 308 |
+
app.launch(show_api=False)
|