Shuairong commited on
Commit
7c0b299
·
verified ·
1 Parent(s): f8dc5f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -19,7 +19,7 @@ yoloed_dir = "yoloed_images"
19
  os.makedirs(original_dir, exist_ok=True)
20
  os.makedirs(yoloed_dir, exist_ok=True)
21
  # Load the trained YOLO model
22
- model_path = "best.pt"
23
  if not os.path.exists(model_path):
24
  raise FileNotFoundError(f"YOLO model not found at {model_path}. Ensure the model is in the correct location.")
25
  model = YOLO(model_path)
@@ -218,6 +218,7 @@ with gr.Blocks() as demo:
218
  room_number_output = gr.Textbox(label="Room Number")
219
  room_numbers = gr.State([])
220
  meter_values = gr.State([])
 
221
 
222
  process_button.click(
223
  fn=process_images,
@@ -242,7 +243,7 @@ with gr.Blocks() as demo:
242
  export_button.click(
243
  fn=export_to_excel,
244
  inputs=[room_numbers, meter_values],
245
- outputs="text"
246
  )
247
 
248
  room_number_output.change(
 
19
  os.makedirs(original_dir, exist_ok=True)
20
  os.makedirs(yoloed_dir, exist_ok=True)
21
  # Load the trained YOLO model
22
+ model_path = "D:/MeterAnnotationTool/best.pt"
23
  if not os.path.exists(model_path):
24
  raise FileNotFoundError(f"YOLO model not found at {model_path}. Ensure the model is in the correct location.")
25
  model = YOLO(model_path)
 
218
  room_number_output = gr.Textbox(label="Room Number")
219
  room_numbers = gr.State([])
220
  meter_values = gr.State([])
221
+ status_output = gr.Textbox(label="Status", interactive=False) # Add a status output
222
 
223
  process_button.click(
224
  fn=process_images,
 
243
  export_button.click(
244
  fn=export_to_excel,
245
  inputs=[room_numbers, meter_values],
246
+ outputs=[status_output] # Update the output to status_output
247
  )
248
 
249
  room_number_output.change(