Adding a sliderInput to a ggplot line chart in ShinyDashboard

I've been struggling to add a functional slider input to my ggplot line chart for "number of observations", but I keep getting errors .. The code below works but the plot does not change ( I tried lots of stuff like adding a reactive function or adding input$obs inside ggplot but it still didn't work) .. I really appreciate your help ! Thanks

library(shiny)
library(shinydashboard)
library(readxl)
library(ggplot2)
library(dashboardthemes)
library(shinyWidgets)
library(dplyr)

df=read_excel("MASI.xlsx")

# Define UI for application that draws a histogram


ui <- dashboardPage(
    
    dashboardHeader(title = "Finance Dashboard"),
    dashboardSidebar(),
    dashboardBody(

        
        # Boxes need to be put in a row (or column)
        fluidRow(
 
        
        box(
            title = "Line chart", status = "primary", solidHeader = TRUE,
            collapsible = TRUE,
            plotOutput("plot1", height = 250)
        ),
        
        box(
            title = "MASI", status = "primary",  solidHeader = TRUE,
            "The MASI index (Moroccan All Shares Index) is a stock index that tracks the performance of all 
                companies listed in the Casablanca Stock Exchange located at Casablanca."
        ),
        
        box(
            title = "Inputs", status = "primary", solidHeader = TRUE,  collapsible = TRUE,
            sliderInput("obs",
                        "Number of observations:",
                        min = 1,
                        max = length(df$MASI),
                        value = 50)
            
            
            
        ),
        
        ),
    ),
    setBackgroundColor(
        color = "white",
        gradient = c("linear", "radial"),
        direction = c("bottom", "top", "right", "left"),
        shinydashboard = TRUE
    )
)



server <- function(input, output) {
    

    output$plot1 <- renderPlot({
       ggplot(df,aes(x=Session, y=MASI)) + geom_line( color="darkblue", size=0.7) + theme_bw()
    }, bg="transparent")
    

}

shinyApp(ui, server)