TobDeBer commited on
Commit
0c489f4
·
1 Parent(s): 0bd8d77

GUI cleanup

Browse files
Files changed (2) hide show
  1. app.py +7 -20
  2. requirements.txt +2 -1
app.py CHANGED
@@ -20,7 +20,7 @@ def load_model():
20
  tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
21
  model = AutoModelForCausalLM.from_pretrained(
22
  MODEL_NAME,
23
- torch_dtype=torch.float32, # Use float32 for CPU
24
  device_map="auto"
25
  )
26
 
@@ -134,20 +134,10 @@ with gr.Blocks() as demo:
134
 
135
  with gr.Row():
136
  with gr.Column(scale=2):
137
- # Model loading section
 
 
138
  with gr.Group():
139
- gr.Markdown("### 📦 Model Management")
140
- model_status = gr.Textbox(
141
- label="Model Status",
142
- value="Model is loading automatically...",
143
- interactive=False
144
- )
145
- load_btn = gr.Button(
146
- "🔄 Reload Model",
147
- variant="primary",
148
- size="lg"
149
- )
150
-
151
  # Generation parameters
152
  gr.Markdown("### ⚙️ Generation Parameters")
153
 
@@ -236,11 +226,7 @@ with gr.Blocks() as demo:
236
  )
237
 
238
  # Event handlers
239
- load_btn.click(
240
- fn=load_model,
241
- outputs=[model_status],
242
- api_visibility="public"
243
- )
244
 
245
  generate_btn.click(
246
  fn=generate_text,
@@ -278,7 +264,8 @@ with gr.Blocks() as demo:
278
  )
279
 
280
  # Auto-load the model at startup
281
- load_model()
 
282
 
283
  # Launch the application
284
  demo.launch(
 
20
  tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
21
  model = AutoModelForCausalLM.from_pretrained(
22
  MODEL_NAME,
23
+ dtype=torch.float32, # Use float32 for CPU
24
  device_map="auto"
25
  )
26
 
 
134
 
135
  with gr.Row():
136
  with gr.Column(scale=2):
137
+ # Model loading section (Removed as per request)
138
+ # The model is loaded automatically at startup.
139
+
140
  with gr.Group():
 
 
 
 
 
 
 
 
 
 
 
 
141
  # Generation parameters
142
  gr.Markdown("### ⚙️ Generation Parameters")
143
 
 
226
  )
227
 
228
  # Event handlers
229
+
 
 
 
 
230
 
231
  generate_btn.click(
232
  fn=generate_text,
 
264
  )
265
 
266
  # Auto-load the model at startup
267
+ load_status = load_model()
268
+ print(f"Startup load status: {load_status}")
269
 
270
  # Launch the application
271
  demo.launch(
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  torch
2
  transformers
3
- gradio
 
1
+ accelerate
2
  torch
3
  transformers
4
+ gradio