My graph displays in Juypyter notebook but when I deploy it on render i get this error TypeError: '>=' not supported between instances of 'str' and 'int'

This is my code for a bar graph that displays the lowest or highest ranked movies and it works when i run it through jupyter notebook on vs code but it does not dispay when i deploy it through render @app.callback(
Output(‘top-ten-movies-bar’, ‘figure’),
[Input(‘genre-checkboxes’, ‘value’),
Input(‘bar-graph-slider’, ‘value’),
Input(‘switch-radio’, ‘value’)]
)

def update_top_ten_movies_bar(selected_genres, selected_years, selected_radio):
if selected_radio == ‘top’:
top_n = 10
order = True

else:
    top_n = 10
    order = False

filtered_movies = df_moviesDT[(df_moviesDT['genre'].isin(selected_genres)) &
                          (df_moviesDT['release_date'] >= selected_years[0]) &
                          (df_moviesDT['release_date'] <= selected_years[1])]

top_movies = (filtered_movies.groupby('title')['rating']
              .mean()
              .nlargest(top_n, keep='all' if order else 'first')
              if order else
              filtered_movies.groupby('title')['rating']
              .mean()
              .nsmallest(top_n, keep='all' if order else 'first'))

fig = go.Figure(go.Bar(x=top_movies.index, y=top_movies.values,
                       marker=dict(color='rgb(158,202,225)', line=dict(color='rgb(8,48,107)', width=1.5))))
fig.update_layout(
    xaxis=dict(title='Movies'),
    yaxis=dict(title='Average Rating'),
    plot_bgcolor='#BAB0AC',
    font=dict(color='#424242'),
)
return fig 

there is this code in the log TypeError: ‘>=’ not supported between instances of ‘str’ and ‘int’

One of df_moviesDT['release_date'] and selected_years[0] is a string, the other is an integer (year).

Most likely, df_moviesDT['release_date'] is a release date like 2009-05-29, and not only a year that you expect it to be, and tested against.

Parse the year out of the release date first. Also, verify your inputs.