oddadmix commited on
Commit
1c40fc0
·
verified ·
1 Parent(s): 629c53a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -19
app.py CHANGED
@@ -9,25 +9,21 @@ import os
9
  model = None
10
  processor = None
11
 
12
- @spaces.GPU
13
- def load_model():
14
- """Load the model and processor once at startup"""
15
- global model, processor
16
-
17
- print("Loading model...")
18
- model, _ = FastModel.from_pretrained(
19
- model_name = "oddadmix/gemma-4b-egyptian-code-switching-b4-g2",
20
- dtype = None,
21
- max_seq_length = 2048,
22
- load_in_4bit = True, # Enable 4bit for GPU memory efficiency
23
- full_finetuning = False,
24
- )
25
-
26
- processor = Gemma3nProcessor.from_pretrained("google/gemma-3n-E4B-it")
27
-
28
- # Set model to inference mode
29
- FastLanguageModel.for_inference(model)
30
- print("Model loaded successfully!")
31
 
32
  @spaces.GPU
33
  def transcribe_audio(audio_path, max_tokens=128):
 
9
  model = None
10
  processor = None
11
 
12
+ print("Loading model...")
13
+ model, _ = FastModel.from_pretrained(
14
+ model_name = "oddadmix/gemma-4b-egyptian-code-switching-b4-g2",
15
+ dtype = None,
16
+ max_seq_length = 2048,
17
+ load_in_4bit = True, # Enable 4bit for GPU memory efficiency
18
+ full_finetuning = False,
19
+ )
20
+
21
+ processor = Gemma3nProcessor.from_pretrained("google/gemma-3n-E4B-it")
22
+
23
+ # Set model to inference mode
24
+ FastLanguageModel.for_inference(model)
25
+ print("Model loaded successfully!")
26
+
 
 
 
 
27
 
28
  @spaces.GPU
29
  def transcribe_audio(audio_path, max_tokens=128):