brxerq commited on
Commit
c695cc2
1 Parent(s): d119104

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -5
app.py CHANGED
@@ -2,29 +2,24 @@
2
  import importlib
3
  import gradio as gr
4
 
5
- # Function to load the model dynamically
6
  def load_model(model_name):
7
  module = importlib.import_module(model_name)
8
  return module
9
 
10
- # Define the models
11
  models = {
12
  "Multi-class model": "model_1",
13
  "Empty class": "model_2",
14
  "Misalignment class": "model_3"
15
  }
16
 
17
- # Function to perform image detection
18
  def detect_image(model_choice, input_image):
19
  model = load_model(models[model_choice])
20
  return model.detect_image(input_image)
21
 
22
- # Function to perform video detection
23
  def detect_video(model_choice, input_video):
24
  model = load_model(models[model_choice])
25
  return model.detect_video(input_video)
26
 
27
- # Create Gradio app
28
  app = gr.Blocks()
29
 
30
  with app:
 
2
  import importlib
3
  import gradio as gr
4
 
 
5
  def load_model(model_name):
6
  module = importlib.import_module(model_name)
7
  return module
8
 
 
9
  models = {
10
  "Multi-class model": "model_1",
11
  "Empty class": "model_2",
12
  "Misalignment class": "model_3"
13
  }
14
 
 
15
  def detect_image(model_choice, input_image):
16
  model = load_model(models[model_choice])
17
  return model.detect_image(input_image)
18
 
 
19
  def detect_video(model_choice, input_video):
20
  model = load_model(models[model_choice])
21
  return model.detect_video(input_video)
22
 
 
23
  app = gr.Blocks()
24
 
25
  with app: