limitedonly41 commited on
Commit
2f420db
·
verified ·
1 Parent(s): 88ac0c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -59,8 +59,11 @@ session = None
59
  # Inference function
60
 
61
  @spaces.GPU()
62
- def predict(image):
63
 
 
 
 
64
  global session
65
 
66
  if session is None:
@@ -91,7 +94,7 @@ def predict(image):
91
 
92
  # Gradio interface
93
  interface = gr.Interface(fn=predict,
94
- inputs=gr.Image(type="numpy", label="Upload an Image"),
95
  outputs=gr.Label(num_top_classes=1, label="Predicted Class"),
96
  title="ONNX Model Image Classification",
97
  description="Upload an image and get the predicted class using the ONNX model.",
 
59
  # Inference function
60
 
61
  @spaces.GPU()
62
+ def predict(file):
63
 
64
+ image = cv2.imread(file.name) # Use the file's path from Gradio
65
+
66
+
67
  global session
68
 
69
  if session is None:
 
94
 
95
  # Gradio interface
96
  interface = gr.Interface(fn=predict,
97
+ inputs=gr.File(label="Upload an Image"), # Change to File input
98
  outputs=gr.Label(num_top_classes=1, label="Predicted Class"),
99
  title="ONNX Model Image Classification",
100
  description="Upload an image and get the predicted class using the ONNX model.",