gbadske
Multiple python scripts
d953e94
Raw History Blame Contribute Delete
1.24 kB
import gradio as gr
import pandas as pd
from datetime import datetime
import config as cf
import gets as gs
# Reset Year Range for selected dataset
def resetYearRange(countryDropdown,slider_1,slider_2):
cf.Globals.country = cf.Globals.countriesList[countryDropdown]
cf.Globals.df_country = cf.Globals.df_all[cf.Globals.df_all["country"]==cf.Globals.country]
yearList = sorted(set(cf.Globals.df_country['year']))
cf.Globals.startYear = yearList[0]
cf.Globals.endYear = yearList[-1]
return ( gr.Slider(minimum=cf.Globals.startYear, maximum=cf.Globals.endYear, step=1, value=cf.Globals.startYear, label="Start Year"),
gr.Slider(minimum=cf.Globals.startYear, maximum=cf.Globals.endYear, step=1, value=cf.Globals.endYear, label="End Year") )
def resetSpecies ( countryDropdown, speciesDropdown ):
cf.Globals.country = cf.Globals.countriesList[countryDropdown]
cf.Globals.df_country = cf.Globals.df_all[cf.Globals.df_all["country"]==cf.Globals.country]
gs.getSpecies(cf.Globals.df_country)
gs.getYearRange(cf.Globals.df_country)
return gr.Dropdown( choices=cf.Globals.speciesList, type="value", value=cf.Globals.species, multiselect=True, label="Species", info="Select Species" )