Aleksander Bojda commited on
Commit
d3b23a0
·
1 Parent(s): 1310d63

Set cache_examples=False and revert workaround changes

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -8,14 +8,11 @@ models = {
8
  }
9
 
10
  def predict(img, model_type):
11
- if model_type in models:
12
- model = models[model_type]
13
- results = model(img, size=640)
14
- detection_img = results.render()[0]
15
 
16
- return detection_img, "Prediction ready"
17
-
18
- return img, f"Model '{model_type}' is not supported"
19
 
20
  # Interface
21
  inputs = [
@@ -25,7 +22,6 @@ inputs = [
25
 
26
  outputs = [
27
  "image",
28
- gr.Textbox(label="Status"),
29
  ]
30
 
31
  examples = [
@@ -35,5 +31,5 @@ examples = [
35
  ["examples/ex4.jpg", None],
36
  ]
37
 
38
- iface = gr.Interface(fn=predict, inputs=inputs, outputs=outputs, examples=examples)
39
  iface.launch()
 
8
  }
9
 
10
  def predict(img, model_type):
11
+ model = models[model_type]
12
+ results = model(img, size=640)
13
+ detection_img = results.render()[0]
 
14
 
15
+ return detection_img
 
 
16
 
17
  # Interface
18
  inputs = [
 
22
 
23
  outputs = [
24
  "image",
 
25
  ]
26
 
27
  examples = [
 
31
  ["examples/ex4.jpg", None],
32
  ]
33
 
34
+ iface = gr.Interface(fn=predict, inputs=inputs, outputs=outputs, examples=examples, cache_examples=False)
35
  iface.launch()