library(extrafont)
font_import()
ui <- fluidPage(
tags$head(
tags$style(HTML("
body {
background-color: #CCCCFF; /* periwinkle blue */
font-family: 'NanumGothic';
}
.btn {
background-color: #EE82EE; /* violet */
border-color: #EE82EE;
font-family: 'NanumGothic';
}
"))
),
titlePanel("영화 장르 예측기"),
sidebarLayout(
sidebarPanel(
checkboxGroupInput("age", "나이", choices=unique(movie$나이), selected=unique(movie$나이)),
selectInput("gender", "성별", choices = unique(movie$성별)),
selectInput("job", "직업", choices = unique(movie$직업)),
selectInput("married", "결혼여부", choices = unique(movie$결혼여부)),
selectInput("relationship", "이성친구 여부", choices = unique(movie$이성친구)),
actionButton("predict", "예측하기")
),
mainPanel(
verbatimTextOutput("prediction")
)
)
)
server <- function(input, output) {
observeEvent(input$predict, {
test_data <- data.frame(
나이 = input$age,
성별 = input$gender,
직업 = input$job,
결혼여부 = input$married,
이성친구 = input$relationship
)
result <- predict(new_model, test_data, type = "prob")
output$prediction <- renderPrint({
result
})
})
}
shinyApp(ui = ui, server = server)
결혼여부랑 이성친구에 '전체'를 넣고 싶은데 왜 YES랑 NO가 사라질까요?? ㅜㅜ
생각처럼 안 되는데 나중에 다시 해보겠습니다ㅠ