Upload folder using huggingface_hub
Browse files- README.md +4 -11
- app.py +58 -0
- ev_model/README.md +5 -0
- ev_model/app.py +58 -0
- ev_model/model.joblib +3 -0
- ev_model/requirements.txt +5 -0
- model.joblib +3 -0
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,12 +1,5 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Ev Performance Demo
|
| 3 |
-
emoji: 🐢
|
| 4 |
-
colorFrom: yellow
|
| 5 |
-
colorTo: yellow
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 6.3.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
+
# 🔋 Electric Vehicle Performance Prediction Model
|
| 3 |
+
|
| 4 |
+
## 👨🎓 Author
|
| 5 |
+
Student Research Project – Academic Year 2024–2025
|
app.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
# =========================
|
| 6 |
+
# Load model
|
| 7 |
+
# =========================
|
| 8 |
+
model = joblib.load("model.joblib")
|
| 9 |
+
|
| 10 |
+
# =========================
|
| 11 |
+
# Prediction function
|
| 12 |
+
# =========================
|
| 13 |
+
def predict_ev(year, make, model_code, ev_type, cafv, utility):
|
| 14 |
+
X = np.array([[year, make, model_code, ev_type, cafv, utility]])
|
| 15 |
+
prediction = model.predict(X)
|
| 16 |
+
return f"🔍 Electric Range dự đoán: {prediction[0]:.2f} km"
|
| 17 |
+
|
| 18 |
+
# =========================
|
| 19 |
+
# Gradio Interface
|
| 20 |
+
# =========================
|
| 21 |
+
with gr.Blocks(title="EV Performance Prediction") as demo:
|
| 22 |
+
gr.Markdown(
|
| 23 |
+
"""
|
| 24 |
+
# 🔋 Electric Vehicle Performance Prediction
|
| 25 |
+
**Dự báo hiệu suất kỹ thuật xe điện (Electric Range)**
|
| 26 |
+
---
|
| 27 |
+
"""
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
gr.Markdown("### 📥 Nhập thông tin xe")
|
| 31 |
+
|
| 32 |
+
with gr.Row():
|
| 33 |
+
year = gr.Number(label="Model Year", value=2020)
|
| 34 |
+
make = gr.Number(label="Make (encoded)", value=10)
|
| 35 |
+
model_code = gr.Number(label="Model (encoded)", value=20)
|
| 36 |
+
|
| 37 |
+
with gr.Row():
|
| 38 |
+
ev_type = gr.Number(label="EV Type (encoded)", value=1)
|
| 39 |
+
cafv = gr.Number(label="CAFV Eligibility (encoded)", value=0)
|
| 40 |
+
utility = gr.Number(label="Electric Utility (encoded)", value=60)
|
| 41 |
+
|
| 42 |
+
predict_btn = gr.Button("🚀 Dự báo hiệu suất")
|
| 43 |
+
output = gr.Textbox(label="Kết quả dự báo")
|
| 44 |
+
|
| 45 |
+
predict_btn.click(
|
| 46 |
+
fn=predict_ev,
|
| 47 |
+
inputs=[year, make, model_code, ev_type, cafv, utility],
|
| 48 |
+
outputs=output
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
gr.Markdown(
|
| 52 |
+
"""
|
| 53 |
+
---
|
| 54 |
+
*Student Research Project – Academic Year 2024–2025*
|
| 55 |
+
"""
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
demo.launch()
|
ev_model/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# 🔋 Electric Vehicle Performance Prediction Model
|
| 3 |
+
|
| 4 |
+
## 👨🎓 Author
|
| 5 |
+
Student Research Project – Academic Year 2024–2025
|
ev_model/app.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
# =========================
|
| 6 |
+
# Load model
|
| 7 |
+
# =========================
|
| 8 |
+
model = joblib.load("model.joblib")
|
| 9 |
+
|
| 10 |
+
# =========================
|
| 11 |
+
# Prediction function
|
| 12 |
+
# =========================
|
| 13 |
+
def predict_ev(year, make, model_code, ev_type, cafv, utility):
|
| 14 |
+
X = np.array([[year, make, model_code, ev_type, cafv, utility]])
|
| 15 |
+
prediction = model.predict(X)
|
| 16 |
+
return f"🔍 Electric Range dự đoán: {prediction[0]:.2f} km"
|
| 17 |
+
|
| 18 |
+
# =========================
|
| 19 |
+
# Gradio Interface
|
| 20 |
+
# =========================
|
| 21 |
+
with gr.Blocks(title="EV Performance Prediction") as demo:
|
| 22 |
+
gr.Markdown(
|
| 23 |
+
"""
|
| 24 |
+
# 🔋 Electric Vehicle Performance Prediction
|
| 25 |
+
**Dự báo hiệu suất kỹ thuật xe điện (Electric Range)**
|
| 26 |
+
---
|
| 27 |
+
"""
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
gr.Markdown("### 📥 Nhập thông tin xe")
|
| 31 |
+
|
| 32 |
+
with gr.Row():
|
| 33 |
+
year = gr.Number(label="Model Year", value=2020)
|
| 34 |
+
make = gr.Number(label="Make (encoded)", value=10)
|
| 35 |
+
model_code = gr.Number(label="Model (encoded)", value=20)
|
| 36 |
+
|
| 37 |
+
with gr.Row():
|
| 38 |
+
ev_type = gr.Number(label="EV Type (encoded)", value=1)
|
| 39 |
+
cafv = gr.Number(label="CAFV Eligibility (encoded)", value=0)
|
| 40 |
+
utility = gr.Number(label="Electric Utility (encoded)", value=60)
|
| 41 |
+
|
| 42 |
+
predict_btn = gr.Button("🚀 Dự báo hiệu suất")
|
| 43 |
+
output = gr.Textbox(label="Kết quả dự báo")
|
| 44 |
+
|
| 45 |
+
predict_btn.click(
|
| 46 |
+
fn=predict_ev,
|
| 47 |
+
inputs=[year, make, model_code, ev_type, cafv, utility],
|
| 48 |
+
outputs=output
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
gr.Markdown(
|
| 52 |
+
"""
|
| 53 |
+
---
|
| 54 |
+
*Student Research Project – Academic Year 2024–2025*
|
| 55 |
+
"""
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
demo.launch()
|
ev_model/model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bb47892592702dc88f2ae782402df93cc4f3ae36b83cc42647262756474e63f
|
| 3 |
+
size 70445
|
ev_model/requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
scikit-learn
|
| 2 |
+
xgboost
|
| 3 |
+
joblib
|
| 4 |
+
numpy
|
| 5 |
+
gardio
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2bb47892592702dc88f2ae782402df93cc4f3ae36b83cc42647262756474e63f
|
| 3 |
+
size 70445
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
scikit-learn
|
| 2 |
+
xgboost
|
| 3 |
+
joblib
|
| 4 |
+
numpy
|
| 5 |
+
gardio
|