Spaces:
Runtime error
Runtime error
jeremyLE-Ekimetrics
commited on
Commit
•
7a7548d
1
Parent(s):
5dd3935
fix plot axes sequence
Browse files- biomap/app.py +1 -1
- biomap/utils.py +12 -10
biomap/app.py
CHANGED
@@ -103,7 +103,7 @@ if __name__ == "__main__":
|
|
103 |
with gr.Row():
|
104 |
timelapse_start_date = gr.Dropdown(choices=[2017,2018,2019,2020,2021,2022,2023], value=2020, label="Start Date")
|
105 |
timelapse_end_date = gr.Dropdown(choices=[2017,2018,2019,2020,2021,2022,2023], value=2021, label="End Date")
|
106 |
-
segmentation = gr.
|
107 |
timelapse_button = gr.Button(value="Predict")
|
108 |
map = gr.Plot()
|
109 |
|
|
|
103 |
with gr.Row():
|
104 |
timelapse_start_date = gr.Dropdown(choices=[2017,2018,2019,2020,2021,2022,2023], value=2020, label="Start Date")
|
105 |
timelapse_end_date = gr.Dropdown(choices=[2017,2018,2019,2020,2021,2022,2023], value=2021, label="End Date")
|
106 |
+
segmentation = gr.Radio(choices=['month', 'year', '2months'], value='year', label="Interval of time between two segmentation")
|
107 |
timelapse_button = gr.Button(value="Predict")
|
108 |
map = gr.Plot()
|
109 |
|
biomap/utils.py
CHANGED
@@ -137,7 +137,7 @@ def plot_imgs_labels(months, imgs, imgs_label, nb_values, scores) :
|
|
137 |
),
|
138 |
scatters[k]
|
139 |
],
|
140 |
-
traces=[0, 1,2,3] # the elements of the list [0,1,2] give info on the traces in fig.data
|
141 |
# that are updated by the above three go.Scatter instances
|
142 |
) for k in range(number_frames)]
|
143 |
|
@@ -215,19 +215,20 @@ def plot_imgs_labels(months, imgs, imgs_label, nb_values, scores) :
|
|
215 |
|
216 |
|
217 |
"xaxis3": {
|
218 |
-
"
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
"yaxis3": {
|
226 |
-
"range": [0,1.
|
227 |
'autorange': False,
|
228 |
'showgrid': False, # thin lines in the background
|
229 |
'zeroline': False, # thick line at y=0
|
230 |
-
'visible':
|
231 |
}
|
232 |
}
|
233 |
)
|
@@ -249,6 +250,7 @@ def plot_imgs_labels(months, imgs, imgs_label, nb_values, scores) :
|
|
249 |
|
250 |
|
251 |
|
|
|
252 |
def transform_to_pil(output, alpha=0.3):
|
253 |
# Transform img with torch
|
254 |
img = torch.moveaxis(prep_for_plot(output['img']),-1,0)
|
|
|
137 |
),
|
138 |
scatters[k]
|
139 |
],
|
140 |
+
traces=[0, 1, 2, 3] # the elements of the list [0,1,2] give info on the traces in fig.data
|
141 |
# that are updated by the above three go.Scatter instances
|
142 |
) for k in range(number_frames)]
|
143 |
|
|
|
215 |
|
216 |
|
217 |
"xaxis3": {
|
218 |
+
"tickmode": "array",
|
219 |
+
"ticktext": months,
|
220 |
+
"tickvals": months,
|
221 |
+
"range": [0,len(months)]
|
222 |
+
# 'showgrid': False, # thin lines in the background
|
223 |
+
# 'zeroline': False, # thick line at y=0
|
224 |
+
# 'visible': True,
|
225 |
+
},
|
226 |
"yaxis3": {
|
227 |
+
"range": [min(scores) * 0.9,max(scores) * 1.1],
|
228 |
'autorange': False,
|
229 |
'showgrid': False, # thin lines in the background
|
230 |
'zeroline': False, # thick line at y=0
|
231 |
+
'visible': True # thin lines in the background
|
232 |
}
|
233 |
}
|
234 |
)
|
|
|
250 |
|
251 |
|
252 |
|
253 |
+
|
254 |
def transform_to_pil(output, alpha=0.3):
|
255 |
# Transform img with torch
|
256 |
img = torch.moveaxis(prep_for_plot(output['img']),-1,0)
|