Spaces:
Runtime error
Runtime error
update desc
Browse files- app.py +7 -3
- climategan_wrapper.py +3 -0
app.py
CHANGED
@@ -86,7 +86,7 @@ if __name__ == "__main__":
|
|
86 |
|
87 |
cg = ClimateGAN(
|
88 |
model_path="config/model/masker",
|
89 |
-
dev_mode=os.environ.get("CG_DEV_MODE", "
|
90 |
)
|
91 |
cg._setup_stable_diffusion()
|
92 |
|
@@ -95,11 +95,15 @@ if __name__ == "__main__":
|
|
95 |
with gr.Column():
|
96 |
gr.Markdown("# ClimateGAN: Visualize Climate Change")
|
97 |
gr.HTML(
|
98 |
-
'Climate change does not impact everyone equally. This Space shows the effects of the climate emergency, "one address at a time". Visit the original experience at <a href="https://thisclimatedoesnotexist.com/">ThisClimateDoesNotExist.com</a>.<br>Enter an address or
|
|
|
99 |
)
|
100 |
with gr.Column():
|
101 |
gr.HTML(
|
102 |
-
"<p style='text-align: center'>
|
|
|
|
|
|
|
103 |
)
|
104 |
with gr.Row():
|
105 |
gr.Markdown("## Inputs")
|
|
|
86 |
|
87 |
cg = ClimateGAN(
|
88 |
model_path="config/model/masker",
|
89 |
+
dev_mode=os.environ.get("CG_DEV_MODE", "").lower() == "true",
|
90 |
)
|
91 |
cg._setup_stable_diffusion()
|
92 |
|
|
|
95 |
with gr.Column():
|
96 |
gr.Markdown("# ClimateGAN: Visualize Climate Change")
|
97 |
gr.HTML(
|
98 |
+
'Climate change does not impact everyone equally. This Space shows the effects of the climate emergency, "one address at a time". Visit the original experience at <a href="https://thisclimatedoesnotexist.com/">ThisClimateDoesNotExist.com</a>.<br>Enter an address or upload a Street View image, and ClimateGAN will generate images showing how the location could be impacted by flooding, wildfires, or smog if it happened there.' # noqa: E501
|
99 |
+
+ "<br><br>This is <strong>not</strong> an exercise in climate prediction, rather an exercise of empathy, to put yourself in other's shoes, as if Climate Change came crushing on your doorstep." # noqa: E501
|
100 |
)
|
101 |
with gr.Column():
|
102 |
gr.HTML(
|
103 |
+
"<p style='text-align: center'>Visit <a href='https://thisclimatedoesnotexist.com/'>ThisClimateDoesNotExist</a> for more information. | Original <a href='https://github.com/cc-ai/climategan'>ClimateGAN GitHub Repo</a></p>" # noqa: E501
|
104 |
+
+ "<p>After you have selected an image and started the inference you will see all the outputs of ClimateGAN, including intermediate outputs such as the flood mask, the segmentation map and the depth maps used to produce the 3 events</p>"
|
105 |
+
+ "<p>This Space makes use of recent Stable Diffusion in-painting pipelines to replace ClimateGAN's original Painter. If you select 'Both' painters, you will see a comparison</p>"
|
106 |
+
+ "<p>Read the original <a href='https://openreview.net/forum?id=EZNOb_uNpJk', target='_blank'>ICLR 2021 ClimateGAN paper</a></p>"
|
107 |
)
|
108 |
with gr.Row():
|
109 |
gr.Markdown("## Inputs")
|
climategan_wrapper.py
CHANGED
@@ -251,6 +251,7 @@ class ClimateGAN:
|
|
251 |
"smog": np.random.randint(0, 255, (640, 640, 3)),
|
252 |
"wildfire": np.random.randint(0, 255, (640, 640, 3)),
|
253 |
}
|
|
|
254 |
image_array = (
|
255 |
np.array(Image.open(orig_image))
|
256 |
if isinstance(orig_image, str)
|
@@ -371,6 +372,8 @@ class ClimateGAN:
|
|
371 |
if pil_image is None
|
372 |
else Image.fromarray(mask[0])
|
373 |
)
|
|
|
|
|
374 |
floods = self.sdip_pipeline(
|
375 |
prompt=[prompt] * images.shape[0],
|
376 |
image=input_images,
|
|
|
251 |
"smog": np.random.randint(0, 255, (640, 640, 3)),
|
252 |
"wildfire": np.random.randint(0, 255, (640, 640, 3)),
|
253 |
}
|
254 |
+
|
255 |
image_array = (
|
256 |
np.array(Image.open(orig_image))
|
257 |
if isinstance(orig_image, str)
|
|
|
372 |
if pil_image is None
|
373 |
else Image.fromarray(mask[0])
|
374 |
)
|
375 |
+
print('input_mask size: ', input_mask.size)
|
376 |
+
print('input_images size: ', input_images.size)
|
377 |
floods = self.sdip_pipeline(
|
378 |
prompt=[prompt] * images.shape[0],
|
379 |
image=input_images,
|