kedimestan commited on
Commit
42f5968
1 Parent(s): d4461b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -31,10 +31,10 @@ model = YOLO(current_model_name)
31
 
32
  def yolov8_inference(
33
  image: gr.Image = None,
34
- model_name: gr.Dropdown = None,
35
- image_size: gr.Slider = 640,
36
- conf_threshold: gr.Slider = 0.25,
37
- iou_threshold: gr.Slider = 0.45,
38
  ):
39
  """
40
  YOLOv8 inference function to return masks and label names for each detected object
@@ -110,7 +110,7 @@ examples = [
110
  ["small-vehicles1.jpeg", "yolov8m-seg.pt", 640, 0.25, 0.45],
111
  ]
112
 
113
- # Build the Gradio demo app
114
  demo_app = gr.Interface(
115
  fn=yolov8_inference,
116
  inputs=inputs,
@@ -121,5 +121,11 @@ demo_app = gr.Interface(
121
  theme="default",
122
  )
123
 
124
- # Launch the app
125
- demo_app.queue().launch(debug=True)
 
 
 
 
 
 
 
31
 
32
  def yolov8_inference(
33
  image: gr.Image = None,
34
+ model_name: str = None,
35
+ image_size: int = 640,
36
+ conf_threshold: float = 0.25,
37
+ iou_threshold: float = 0.45,
38
  ):
39
  """
40
  YOLOv8 inference function to return masks and label names for each detected object
 
110
  ["small-vehicles1.jpeg", "yolov8m-seg.pt", 640, 0.25, 0.45],
111
  ]
112
 
113
+ # Build the Gradio demo app with POST functionality
114
  demo_app = gr.Interface(
115
  fn=yolov8_inference,
116
  inputs=inputs,
 
121
  theme="default",
122
  )
123
 
124
+ # Launch the app with API-enabled functionality
125
+ demo_app.queue().launch(
126
+ enable_queue=True, # Allow for API-style interactions
127
+ debug=True, # Show detailed errors in case of issues
128
+ server_name="0.0.0.0", # Host on all IPs
129
+ server_port=7860, # Custom port for accessing the app
130
+ share=True # To make the app accessible from a URL
131
+ )