ibrahim yıldız commited on
Commit
eaea12c
·
verified ·
1 Parent(s): c48d6d3

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +42 -0
  2. gb_model_best.pkl +3 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import pickle
4
+
5
+ with open('gb_model_best.pkl', 'rb') as f:
6
+ gb_model_best = pickle.load(f)
7
+
8
+ # Create a Streamlit app
9
+ st.title("Movie Revenue Predictor")
10
+
11
+ # Create input fields for the user
12
+ popularity = st.number_input("Popularity (out of 10):")
13
+ runtime = st.number_input("Runtime (in minutes):")
14
+ is_original_en = st.selectbox("Is the movie in English?", ["Yes", "No"])
15
+
16
+ # Create a conditional input field for budget
17
+ budget_known = st.selectbox("Is the budget known?", ["Yes", "No"])
18
+ if budget_known == "Yes":
19
+ budget_M = st.number_input("Budget (in millions of dollars):")
20
+ else:
21
+ budget_M = 10
22
+
23
+ # Create a submit button
24
+ submitted = st.button("Predict Revenue")
25
+
26
+ # When the user submits the form, make a prediction
27
+ if submitted:
28
+ # Create a DataFrame with the user's input data
29
+ input_data = pd.DataFrame({
30
+ "popularity": [popularity],
31
+ "runtime": [runtime],
32
+ "budget_known": [int(budget_known == "Yes")],
33
+ "budget_M": [budget_M],
34
+ "is_original_en": [int(is_original_en == "Yes")]
35
+ })
36
+
37
+ # Make a prediction using the trained model
38
+ input_data = input_data[gb_model_best.feature_names_in_]
39
+ prediction = gb_model_best.predict(input_data)[0]
40
+
41
+ # Display the predicted revenue
42
+ st.write(f"Predicted Revenue: ${prediction:.2f} million")
gb_model_best.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dd8f3c8049c95f288eb61610701723cefa1050fae801a44037d3f0a4bc9df8b
3
+ size 620852
requirements.txt ADDED
File without changes