Coots commited on
Commit
74136c1
Β·
verified Β·
1 Parent(s): 3fbfd45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -8,13 +8,17 @@ from fpdf import FPDF
8
  import tempfile
9
  from deep_translator import GoogleTranslator
10
  import warnings
 
 
11
  warnings.filterwarnings("ignore")
12
 
13
- # Load models
14
- xgb = joblib.load("xgb_model.json")
 
 
15
  rf = joblib.load("rf_model.pkl")
16
 
17
- # Load catalog and sizes
18
  with open("tile_catalog.json", "r", encoding="utf-8") as f:
19
  tile_catalog = json.load(f)
20
 
@@ -159,7 +163,7 @@ def chat_fn(message, history, user_state={}):
159
 
160
  return reply("Type 'Floor' or 'Wall' to begin a new estimate."), None, user_state
161
 
162
- # Launch with clean intro
163
  with gr.Blocks() as demo:
164
  chatbot = gr.ChatInterface(
165
  fn=chat_fn,
@@ -175,4 +179,4 @@ with gr.Blocks() as demo:
175
  additional_outputs=[gr.File(label="πŸ“„ Download Report")]
176
  )
177
 
178
- demo.launch()
 
8
  import tempfile
9
  from deep_translator import GoogleTranslator
10
  import warnings
11
+ import xgboost as xgb # βœ… Correct import for native XGBoost model
12
+
13
  warnings.filterwarnings("ignore")
14
 
15
+ # βœ… Load models
16
+ xgb_model = xgb.Booster()
17
+ xgb_model.load_model("xgb_model.json") # βœ… Load native .json format
18
+
19
  rf = joblib.load("rf_model.pkl")
20
 
21
+ # βœ… Load catalog and sizes
22
  with open("tile_catalog.json", "r", encoding="utf-8") as f:
23
  tile_catalog = json.load(f)
24
 
 
163
 
164
  return reply("Type 'Floor' or 'Wall' to begin a new estimate."), None, user_state
165
 
166
+ # βœ… Launch with clean intro
167
  with gr.Blocks() as demo:
168
  chatbot = gr.ChatInterface(
169
  fn=chat_fn,
 
179
  additional_outputs=[gr.File(label="πŸ“„ Download Report")]
180
  )
181
 
182
+ demo.launch()