lsadouk1111 commited on
Commit
87dc88d
·
verified ·
1 Parent(s): 5c6f553

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -13,16 +13,22 @@ import spaces
13
  # ── Model loading ─────────────────────────────────────────────────────────────
14
  MODEL_ID = "lsadouk1111/VisualStep"
15
 
16
- print("Loading VisualStep model...")
17
- model, tokenizer = FastModel.from_pretrained(
18
- model_name=MODEL_ID,
19
- max_seq_length=512,
20
- load_in_4bit=True,
21
- dtype=None,
22
- )
23
- FastModel.for_inference(model)
24
- model.eval()
25
- print("Model ready.")
 
 
 
 
 
 
26
 
27
  # ── System prompt ─────────────────────────────────────────────────────────────
28
  SYSTEM_PROMPT = """You are an expert in ADHD classroom accommodations for primary school children aged 5-10.
 
13
  # ── Model loading ─────────────────────────────────────────────────────────────
14
  MODEL_ID = "lsadouk1111/VisualStep"
15
 
16
+ model = None
17
+ tokenizer = None
18
+
19
+ def load_model():
20
+ global model, tokenizer
21
+ if model is None:
22
+ print("Loading VisualStep model...")
23
+ model, tokenizer = FastModel.from_pretrained(
24
+ model_name=MODEL_ID,
25
+ max_seq_length=512,
26
+ load_in_4bit=True,
27
+ dtype=None,
28
+ )
29
+ FastModel.for_inference(model)
30
+ model.eval()
31
+ print("Model ready.")
32
 
33
  # ── System prompt ─────────────────────────────────────────────────────────────
34
  SYSTEM_PROMPT = """You are an expert in ADHD classroom accommodations for primary school children aged 5-10.