File size: 2,151 Bytes
7791531
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import pandas as pd
import pickle
import numpy as py
import streamlit as st
import gdown

# File IDs
model_id = "1HSQTjJ_hvBBmVJmYUmrkq5T7ubpfDwzF"
top_country_id = "1aLkaAqfrs3GcrMvZcuyQ0NjFhAhrdIlR"

model_url = f"https://drive.google.com/uc?id={model_id}"
top_country_url = f"https://drive.google.com/uc?id={top_country_id}"


@st.cache_resource
def load_model():
    gdown.download(model_url, "best_rf_model.pkl", quiet=False)
    with open("best_rf_model.pkl", "rb") as f:
        return pickle.load(f)


@st.cache_resource
def load_top_country():
    gdown.download(top_country_url, "top_country.pkl", quiet=False)
    with open("top_country.pkl", "rb") as f:
        return pickle.load(f)


model = load_model()
top_country = load_top_country()
# Load


def run():
    with st.form(key="hotel_bookings"):
        name = st.selectbox("Hotel Type", ("city_hotel", "resort_hotel"), index=0)
        lead = st.number_input(
            "Lead Time",
            min_value=0,
            max_value=600,
            value=0,
            step=1,
            help="jarak antar waktu booking dan check-in",
        )
        arrival_year = st.selectbox("Arrival Year", ("2015", "2016", "2017"), index=0)
        arrival_month = st.selectbox(
            "Arrival Months",
            (
                "January",
                "February",
                "March",
                "April",
                "May",
                "June",
                "July",
                "August",
                "September",
                "October",
                "November",
                "December",
            ),
            index=0,
        )
        arrival_week = st.number_input(
            "Arrival Weeks",
            min_value=1,
            max_value=52,
            value=1,
            step=1,
            help="minggu kedatangan",
        )
        arrival_day = st.number_input(
            "Arrival Days",
            min_value=1,
            max_value=31,
            value=1,
            step=1,
            help="tanggal kedatangan",
        )

        submitted = st.form_submit_button("Predict")


if __name__ == "_main_":
    run()