Spaces:
Runtime error
Runtime error
Commit
·
8ffa503
1
Parent(s):
b8c2ceb
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,56 +56,73 @@ with gr.Blocks(css=css) as demo:
|
|
| 56 |
with gr.Column():
|
| 57 |
ref_btn = gr.Button('Refresh')
|
| 58 |
gr.Column()
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
| 60 |
# Create a tab for the newest predictions (in our case 2 days old...) and for old prediction and the performance
|
| 61 |
with gr.Tabs():
|
| 62 |
with gr.TabItem('Latest weather prediction'):
|
| 63 |
# Create rows with two figures each
|
| 64 |
with gr.Row():
|
| 65 |
with gr.Column():
|
| 66 |
-
temp = gr.Image(label='Temperature (°C)', show_download_button=True,
|
|
|
|
| 67 |
with gr.Column():
|
| 68 |
-
app_temp = gr.Image(label='Apparent temperature (°C)', show_download_button=True,
|
|
|
|
| 69 |
with gr.Row():
|
| 70 |
with gr.Column():
|
| 71 |
-
rain = gr.Image(label='Rain (mm)', show_download_button=True, interactive=False)
|
| 72 |
with gr.Column():
|
| 73 |
-
snow = gr.Image(label='snowfall (cm)', show_download_button=True,
|
|
|
|
| 74 |
with gr.Row():
|
| 75 |
with gr.Column():
|
| 76 |
-
press = gr.Image(label='Surface pressure (hPa)', show_download_button=True,
|
|
|
|
| 77 |
with gr.Column():
|
| 78 |
-
cloud = gr.Image(label='cloud_cover (%)', show_download_button=True,
|
|
|
|
| 79 |
with gr.Row():
|
| 80 |
with gr.Column():
|
| 81 |
-
speed = gr.Image(label='Wind speed (km/h)', show_download_button=True,
|
|
|
|
| 82 |
with gr.Column():
|
| 83 |
-
direction = gr.Image(label='Wind direction (°)', show_download_button=True,
|
|
|
|
| 84 |
|
| 85 |
with gr.TabItem('Previous prediction performance'):
|
| 86 |
with gr.Row():
|
| 87 |
with gr.Column():
|
| 88 |
-
ptemp = gr.Image(label=r'Temperature (°C)', show_download_button=True,
|
|
|
|
| 89 |
with gr.Column():
|
| 90 |
-
papp_temp = gr.Image(label='Apparent temperature (°C)', show_download_button=True,
|
|
|
|
| 91 |
with gr.Row():
|
| 92 |
with gr.Column():
|
| 93 |
-
prain = gr.Image(label='Rain (mm)', show_download_button=True, interactive=False)
|
| 94 |
with gr.Column():
|
| 95 |
-
psnow = gr.Image(label='snowfall (cm)', show_download_button=True,
|
|
|
|
| 96 |
with gr.Row():
|
| 97 |
with gr.Column():
|
| 98 |
-
ppress = gr.Image(label='Surface pressure (hPa)', show_download_button=True,
|
|
|
|
| 99 |
with gr.Column():
|
| 100 |
-
pcloud = gr.Image(label='cloud_cover (%)', show_download_button=True,
|
|
|
|
| 101 |
with gr.Row():
|
| 102 |
with gr.Column():
|
| 103 |
-
pspeed = gr.Image(label='Wind speed (km/h)', show_download_button=True,
|
|
|
|
| 104 |
with gr.Column():
|
| 105 |
-
pdirection = gr.Image(label='Wind direction (°)', show_download_button=True,
|
|
|
|
| 106 |
|
| 107 |
# On button click update all images:
|
| 108 |
ref_btn.click(refresh_images, inputs=None, outputs=[temp, ptemp, app_temp, papp_temp, rain, prain, snow, psnow,
|
| 109 |
press, ppress, cloud, pcloud, speed, pspeed, direction, pdirection])
|
| 110 |
|
| 111 |
-
demo.launch()
|
|
|
|
| 56 |
with gr.Column():
|
| 57 |
ref_btn = gr.Button('Refresh')
|
| 58 |
gr.Column()
|
| 59 |
+
|
| 60 |
+
# Load the initial images
|
| 61 |
+
images = refresh_images()
|
| 62 |
+
|
| 63 |
# Create a tab for the newest predictions (in our case 2 days old...) and for old prediction and the performance
|
| 64 |
with gr.Tabs():
|
| 65 |
with gr.TabItem('Latest weather prediction'):
|
| 66 |
# Create rows with two figures each
|
| 67 |
with gr.Row():
|
| 68 |
with gr.Column():
|
| 69 |
+
temp = gr.Image(value=images[0], label='Temperature (°C)', show_download_button=True,
|
| 70 |
+
interactive=False)
|
| 71 |
with gr.Column():
|
| 72 |
+
app_temp = gr.Image(value=images[2], label='Apparent temperature (°C)', show_download_button=True,
|
| 73 |
+
interactive=False)
|
| 74 |
with gr.Row():
|
| 75 |
with gr.Column():
|
| 76 |
+
rain = gr.Image(value=images[4], label='Rain (mm)', show_download_button=True, interactive=False)
|
| 77 |
with gr.Column():
|
| 78 |
+
snow = gr.Image(value=images[6], label='snowfall (cm)', show_download_button=True,
|
| 79 |
+
interactive=False)
|
| 80 |
with gr.Row():
|
| 81 |
with gr.Column():
|
| 82 |
+
press = gr.Image(value=images[8], label='Surface pressure (hPa)', show_download_button=True,
|
| 83 |
+
interactive=False)
|
| 84 |
with gr.Column():
|
| 85 |
+
cloud = gr.Image(value=images[10], label='cloud_cover (%)', show_download_button=True,
|
| 86 |
+
interactive=False)
|
| 87 |
with gr.Row():
|
| 88 |
with gr.Column():
|
| 89 |
+
speed = gr.Image(value=images[12], label='Wind speed (km/h)', show_download_button=True,
|
| 90 |
+
interactive=False)
|
| 91 |
with gr.Column():
|
| 92 |
+
direction = gr.Image(value=images[14], label='Wind direction (°)', show_download_button=True,
|
| 93 |
+
interactive=False)
|
| 94 |
|
| 95 |
with gr.TabItem('Previous prediction performance'):
|
| 96 |
with gr.Row():
|
| 97 |
with gr.Column():
|
| 98 |
+
ptemp = gr.Image(value=images[1], label=r'Temperature (°C)', show_download_button=True,
|
| 99 |
+
interactive=False)
|
| 100 |
with gr.Column():
|
| 101 |
+
papp_temp = gr.Image(value=images[3], label='Apparent temperature (°C)', show_download_button=True,
|
| 102 |
+
interactive=False)
|
| 103 |
with gr.Row():
|
| 104 |
with gr.Column():
|
| 105 |
+
prain = gr.Image(value=images[5], label='Rain (mm)', show_download_button=True, interactive=False)
|
| 106 |
with gr.Column():
|
| 107 |
+
psnow = gr.Image(value=images[7], label='snowfall (cm)', show_download_button=True,
|
| 108 |
+
interactive=False)
|
| 109 |
with gr.Row():
|
| 110 |
with gr.Column():
|
| 111 |
+
ppress = gr.Image(value=images[9], label='Surface pressure (hPa)', show_download_button=True,
|
| 112 |
+
interactive=False)
|
| 113 |
with gr.Column():
|
| 114 |
+
pcloud = gr.Image(value=images[11], label='cloud_cover (%)', show_download_button=True,
|
| 115 |
+
interactive=False)
|
| 116 |
with gr.Row():
|
| 117 |
with gr.Column():
|
| 118 |
+
pspeed = gr.Image(value=images[13], label='Wind speed (km/h)', show_download_button=True,
|
| 119 |
+
interactive=False)
|
| 120 |
with gr.Column():
|
| 121 |
+
pdirection = gr.Image(value=images[15], label='Wind direction (°)', show_download_button=True,
|
| 122 |
+
interactive=False)
|
| 123 |
|
| 124 |
# On button click update all images:
|
| 125 |
ref_btn.click(refresh_images, inputs=None, outputs=[temp, ptemp, app_temp, papp_temp, rain, prain, snow, psnow,
|
| 126 |
press, ppress, cloud, pcloud, speed, pspeed, direction, pdirection])
|
| 127 |
|
| 128 |
+
demo.launch()
|