Spaces:
Sleeping
Sleeping
File size: 1,352 Bytes
0594bbd 5b39c6e 0594bbd 5b39c6e 0594bbd 5b39c6e 0594bbd 5b39c6e 0594bbd 5b39c6e 0594bbd 5b39c6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
library(shiny)
library(bslib)
library(vetiver)
endpoint <-
vetiver_endpoint("https://jameshwade-penguins-model.hf.space/predict")
ui <- bslib::page_sidebar(
sidebar = sidebar(
selectInput("species", "Select Species",
choices = c("Adelie", "Chinstrap", "Gentoo")),
sliderInput("bill_length_mm", "Enter Bill Length (mm):",
min = 30, max = 60, step = 0.5, value = 45),
sliderInput("bill_depth_mm", "Enter Bill Depth (mm):",
min = 10, max = 22, step = 0.5, value = 15),
sliderInput("flipper_length_mm", "Enter Flipper Length (mm):",
min = 170, max = 235, step = 0.5, value = 200),
sliderInput("body_mass_g", "Enter Body Mass (g):",
min = 2700, max = 6300, step = 10, value = 3500),
actionButton("predict", "Predict"),
open = TRUE
),
verbatimTextOutput("info")
)
server <- function(input, output, session) {
observe({
new_data <- data.frame(
species = input$species,
bill_length_mm = input$bill_length_mm,
bill_depth_mm = input$bill_depth_mm,
flipper_length_mm = input$flipper_length_mm,
body_mass_g = input$body_mass_g
)
prediction <- predict(endpoint, new_data)
output$info <- renderPrint(prediction)
}) |> bindEvent(input$predict)
}
shinyApp(ui, server) |