HemanM commited on
Commit
cb9a19a
·
verified ·
1 Parent(s): 83028c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -1,4 +1,14 @@
1
  import os
 
 
 
 
 
 
 
 
 
 
2
  import gradio as gr
3
  import random
4
 
@@ -7,12 +17,6 @@ from logger import log_user_feedback
7
  from dashboard import update_dashboard_plot
8
  from watchdog import retrain_model
9
 
10
- # ✅ Check if trained_model/config.json exists, if not, initialize the model
11
- if not os.path.exists("trained_model/config.json"):
12
- from init_model import initialize_and_save_model
13
- print("⚙️ Reinitializing EvoTransformer model...")
14
- initialize_and_save_model()
15
-
16
  # 🎲 Random examples
17
  examples = [
18
  {
 
1
  import os
2
+
3
+ # 🛡️ Ensure model is saved before importing anything that loads it
4
+ if not os.path.exists("trained_model/config.json"):
5
+ print("⚙️ No model found. Initializing and saving EvoTransformer...")
6
+ from init_model import initialize_and_save_model
7
+ initialize_and_save_model()
8
+ else:
9
+ print("✅ EvoTransformer already initialized.")
10
+
11
+
12
  import gradio as gr
13
  import random
14
 
 
17
  from dashboard import update_dashboard_plot
18
  from watchdog import retrain_model
19
 
 
 
 
 
 
 
20
  # 🎲 Random examples
21
  examples = [
22
  {