Skip to content

Commit

Permalink
Merge pull request #24 from dncq/dev/model
Browse files Browse the repository at this point in the history
add: data and prepare predict model
  • Loading branch information
dncq committed Dec 26, 2023
2 parents 749bc01 + c5a8889 commit 8cc06b4
Show file tree
Hide file tree
Showing 6 changed files with 3,136 additions and 12 deletions.
1,381 changes: 1,381 additions & 0 deletions Data/processed/processed_bhp.csv

Large diffs are not rendered by default.

File renamed without changes.
14 changes: 2 additions & 12 deletions src/app/app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import streamlit as st

laptop_config = {
'Company': ['Apple', 'Best Notebooks', 'Microsoft', 'GIGABYTE', 'Panasonic', 'Samsung', 'LG', 'MSI',
'Asus', 'Acer', 'HP', 'Lenovo',
'Dell'],
'Brand': ['Dell','Apple', 'Lenovo', 'HP', 'Asus', 'Acer', 'MSI', 'Microsoft', 'Other'],
'CPU': ['i5', 'i7', 'Ryzen 5', 'Ryzen 7'],
'RAM': ['8GB', '16GB', '32GB'],
'GPU': ['Integrated', 'NVIDIA GTX', 'NVIDIA RTX', 'AMD Radeon'],
'Storage': ['256GB SSD', '512GB SSD', '1TB HDD', '1TB SSD']
}

st.title('Are You Sure Prediction')

st.button("Button thoi :)))")
st.title('Laptop Price Prediction')

st.caption("#fromhelaricawithluv")

st.checkbox("I am sure vailon!")

st.code('''def answer_tqk(question: str)
if question == "Are you sure?":
print("I am sure vailon")''')

company = st.selectbox('Brand', laptop_config['Company'])
cpu = st.selectbox('CPU', laptop_config['CPU'])
# ram = st.selectbox('RAM', laptop_config['RAM'])
Expand Down
46 changes: 46 additions & 0 deletions src/app/predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import pickle as pk
import pandas as pd
from mapping import *

def predict(model_name: pk.Pickler,
brand: str,
cpu_name: str,
gpu_name: str,
monitor: str,
monitor_size: str,
ram: str,
storage: str,
os: str,
weight: str) -> float:

PARENT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
PARENT_PATH = os.path.abspath(os.path.join(PARENT_PATH, '..'))
DATA_PATH = os.path.abspath(os.path.join(PARENT_PATH, "data", "raw", "cpu_gpu_mark"))

CPU_FILENAME = "cpu_mark.csv"
GPU_FILENAME = "gpu_mark.csv"

cpu_df = pd.read_csv(os.path.abspath(os.path.join(DATA_PATH, CPU_FILENAME)), index_col = 0)
gpu_df = pd.read_csv(os.path.abspath(os.path.join(DATA_PATH, GPU_FILENAME)), index_col = 0)

cpu_name_list = [cpu_df['CPU Name'][idx].lower() for idx in cpu_df.index]
gpu_name_list = [gpu_df['GPU Name'][idx].lower() for idx in gpu_df.index]

# Transform data to predict
name_cpu, cpu_mark = get_cpu_name(cpu_name)
name_gpu, gpu_mark = get_gpu_name(gpu_name)

# Monitor to Float
if "\"" in monitor or "\'" in monitor:
elements = monitor.split()
if len(elements) == 2:
pros_monitor, _ = elements[0], elements[1]
pros_monitor = float(pros_monitor[:-1])

if len(elements) == 1:
monitor = elements[0]
pros_monitor = float(pros_monitor[:-1])
else:
pros_monitor = float(monitor[:-1])


Empty file removed src/app/transform_input.py
Empty file.
Loading

0 comments on commit 8cc06b4

Please sign in to comment.