gaialive commited on
Commit
0dc505c
·
verified ·
1 Parent(s): 133e60c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,17 +6,17 @@ import joblib
6
  model = joblib.load("biochar_lightgbm_model.pkl")
7
  le = joblib.load("biochar_label_encoder.pkl")
8
 
9
- # รายชื่อฟีเจอร์
10
  feature_names = ['SurfaceArea', 'Fixed Carbon', 'pH', 'Pore Volume', 'Pore Size', 'Energy Content']
11
 
12
- # ฟังก์ชันทำนาย
13
  def recommend_with_probs(surface_area, fixed_carbon, pH, pore_volume, pore_size, energy_content):
14
  input_data = pd.DataFrame([[surface_area, fixed_carbon, pH, pore_volume, pore_size, energy_content]],
15
  columns=feature_names)
16
  pred_class = model.predict(input_data)[0]
17
  pred_label = le.inverse_transform([pred_class])[0]
18
 
19
- # ทำนายความน่าจะเป็น
20
  probs = model.predict_proba(input_data)[0]
21
  prob_labels = le.inverse_transform(range(len(probs)))
22
  prob_df = pd.DataFrame({
@@ -35,8 +35,8 @@ h1, h2, h3, h4 {text-align: center;}
35
  """
36
 
37
  with gr.Blocks(css=css, title="Biochar Application Recommender") as demo:
38
- gr.Markdown("# 🌱 Biochar Application Recommender")
39
- gr.Markdown("**ระบบแนะนำการประยุกต์ใช้งานไบโอชาร์โดยอิงจากคุณสมบัติทางเคมีและกายภาพ**")
40
 
41
  with gr.Row():
42
  with gr.Column():
 
6
  model = joblib.load("biochar_lightgbm_model.pkl")
7
  le = joblib.load("biochar_label_encoder.pkl")
8
 
9
+ # Danh sách các tính năng
10
  feature_names = ['SurfaceArea', 'Fixed Carbon', 'pH', 'Pore Volume', 'Pore Size', 'Energy Content']
11
 
12
+ # Chức năng dự đoán
13
  def recommend_with_probs(surface_area, fixed_carbon, pH, pore_volume, pore_size, energy_content):
14
  input_data = pd.DataFrame([[surface_area, fixed_carbon, pH, pore_volume, pore_size, energy_content]],
15
  columns=feature_names)
16
  pred_class = model.predict(input_data)[0]
17
  pred_label = le.inverse_transform([pred_class])[0]
18
 
19
+ # Dự đoán xác suất
20
  probs = model.predict_proba(input_data)[0]
21
  prob_labels = le.inverse_transform(range(len(probs)))
22
  prob_df = pd.DataFrame({
 
35
  """
36
 
37
  with gr.Blocks(css=css, title="Biochar Application Recommender") as demo:
38
+ gr.Markdown("# 🌱 Chuyên gia AI tư vấn ứng dụng Than sinh học")
39
+ gr.Markdown("** Hệ thống khuyến nghị ứng dụng than sinh học dựa trên tính chất hóa học và vật lý **")
40
 
41
  with gr.Row():
42
  with gr.Column():