climategan /
NimaBoscarino's picture
Remove perspective choice, add description
history blame contribute delete
No virus
1.9 kB
import os
import gradio as gr
import googlemaps
from skimage import io
from urllib import parse
from inferences import ClimateGAN
API_KEY = os.environ.get("API_KEY")
gmaps = googlemaps.Client(key=API_KEY)
model = ClimateGAN(model_path="config/model/masker")
def predict(place):
geocode_result = gmaps.geocode(place)
address = geocode_result[0]['formatted_address']
static_map_url = f"{parse.quote(address)}&source=outdoor&key={API_KEY}"
img_np = io.imread(static_map_url)
flood, wildfire, smog = model.inference(img_np)
return img_np, flood, wildfire, smog
gr.inputs.Textbox(label="Address or place name"),
gr.outputs.Image(type="numpy", label="Original image"),
gr.outputs.Image(type="numpy", label="Flooding"),
gr.outputs.Image(type="numpy", label="Wildfire"),
gr.outputs.Image(type="numpy", label="Smog"),
title="ClimateGAN: Visualize Climate Change",
description="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=\"\"></a>.<br>Enter an address or place name, and ClimateGAN will generate images showing how the location could be impacted by flooding, wildfires, or smog.",
article="<p style='text-align: center'>This project is an unofficial clone of <a href=''>ThisClimateDoesNotExist</a> | <a href=''>ClimateGAN GitHub Repo</a></p>",
"Vancouver Art Gallery",
"Chicago Bean",
"Duomo Siracusa",
css=".footer{display:none !important}",