jayanth7111 commited on
Commit
bb1c8db
·
verified ·
1 Parent(s): 46d7346

Enable verbose errors in Gradio app

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -3,10 +3,8 @@ import numpy as np
3
  import onnxruntime as ort
4
  from PIL import Image
5
 
6
- # Load your ONNX model
7
  sess = ort.InferenceSession("visionguard_simplified.onnx", providers=["CPUExecutionProvider"])
8
 
9
- # Preprocess + inference
10
  def detect_corruption(img: Image.Image):
11
  img = img.resize((128,128)).convert("RGB")
12
  arr = np.array(img).astype(np.float32)/255.0
@@ -17,7 +15,6 @@ def detect_corruption(img: Image.Image):
17
  prob = float(1/(1+np.exp(-logits[0,0])))
18
  return {"clean": 1-prob, "corrupted": prob}
19
 
20
- # Gradio interface
21
  iface = gr.Interface(
22
  fn=detect_corruption,
23
  inputs=gr.Image(type="pil"),
@@ -27,4 +24,4 @@ iface = gr.Interface(
27
  )
28
 
29
  if __name__=="__main__":
30
- iface.launch()
 
3
  import onnxruntime as ort
4
  from PIL import Image
5
 
 
6
  sess = ort.InferenceSession("visionguard_simplified.onnx", providers=["CPUExecutionProvider"])
7
 
 
8
  def detect_corruption(img: Image.Image):
9
  img = img.resize((128,128)).convert("RGB")
10
  arr = np.array(img).astype(np.float32)/255.0
 
15
  prob = float(1/(1+np.exp(-logits[0,0])))
16
  return {"clean": 1-prob, "corrupted": prob}
17
 
 
18
  iface = gr.Interface(
19
  fn=detect_corruption,
20
  inputs=gr.Image(type="pil"),
 
24
  )
25
 
26
  if __name__=="__main__":
27
+ iface.launch(show_error=True)