aakashv100 commited on
Commit
da1a26d
·
1 Parent(s): b77cc5e

chore: Refactor app.py for improved readability and performance

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -8,9 +8,8 @@ import os
8
  def inference(img):
9
  name_tag = uuid.uuid4()
10
  script_command = f"python yolov9/detect_dual.py --source {img} --img 640 --device cpu --weights yolov9/runs/train/exp2/weights/best.pt --name {name_tag}"
11
- os.system(script_command)
12
- output_file = f"yolov9/runs/detect/{name_tag}/{img.split('/')[-1]}"
13
- return output_file
14
 
15
  title = "Sketch GUI Element Detection"
16
 
@@ -30,4 +29,4 @@ demo = gr.Interface(fn=inference,
30
  description=description,
31
  examples=example_lst)
32
 
33
- demo.launch(debug=True)
 
8
  def inference(img):
9
  name_tag = uuid.uuid4()
10
  script_command = f"python yolov9/detect_dual.py --source {img} --img 640 --device cpu --weights yolov9/runs/train/exp2/weights/best.pt --name {name_tag}"
11
+ os.system(script_command)
12
+ return f"yolov9/runs/detect/{name_tag}/{img.split('/')[-1]}"
 
13
 
14
  title = "Sketch GUI Element Detection"
15
 
 
29
  description=description,
30
  examples=example_lst)
31
 
32
+ demo.launch(share=True)