CowcatcherAI commited on
Commit
92c113e
·
verified ·
1 Parent(s): aaafbb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -2,10 +2,9 @@ import gradio as gr
2
  from ultralytics import YOLO
3
  from PIL import Image
4
 
5
- # We laden de modellen in een dictionary zodat ze maar één keer geladen worden
6
  models = {
7
- "CowCatcherV15" : YOLO('cowcatcherV15.pt'),
8
- "CowCatcherV16 (Experimental)": YOLO('cowcatcherV16.pt') # Pas de bestandsnaam aan
9
  }
10
 
11
  description_text = """
@@ -14,23 +13,18 @@ By analyzing live footage from your barn cameras, it automatically detects "moun
14
  """
15
 
16
  def predict(img, model_name, conf_threshold):
17
- # Selecteer het juiste model uit de dictionary
18
  selected_model = models[model_name]
19
-
20
- # Voer de voorspelling uit met de gekozen confidence
21
  results = selected_model(img, conf=conf_threshold)
22
  res_plotted = results[0].plot()
23
-
24
  return Image.fromarray(res_plotted[:, :, ::-1])
25
 
26
- # De Interface
27
  demo = gr.Interface(
28
  fn=predict,
29
  inputs=[
30
  gr.Image(type="pil", label="Upload barn image"),
31
  gr.Dropdown(
32
  choices=list(models.keys()),
33
- value="CowCatcher v1 (Standard)",
34
  label="Select Model"
35
  ),
36
  gr.Slider(
 
2
  from ultralytics import YOLO
3
  from PIL import Image
4
 
 
5
  models = {
6
+ "CowCatcherV15": YOLO('cowcatcherV15.pt'),
7
+ "CowCatcherV16 (Experimental)": YOLO('cowcatcherV16.pt')
8
  }
9
 
10
  description_text = """
 
13
  """
14
 
15
  def predict(img, model_name, conf_threshold):
 
16
  selected_model = models[model_name]
 
 
17
  results = selected_model(img, conf=conf_threshold)
18
  res_plotted = results[0].plot()
 
19
  return Image.fromarray(res_plotted[:, :, ::-1])
20
 
 
21
  demo = gr.Interface(
22
  fn=predict,
23
  inputs=[
24
  gr.Image(type="pil", label="Upload barn image"),
25
  gr.Dropdown(
26
  choices=list(models.keys()),
27
+ value="CowCatcherV15",
28
  label="Select Model"
29
  ),
30
  gr.Slider(