NerdyAlgorithm commited on
Commit
e758c0d
·
verified ·
1 Parent(s): 9fd3fcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -11,7 +11,12 @@ def predict(image):
11
  arr = (np.array(img, dtype=np.float32) / 127.5) - 1.0
12
  preds = model.predict(np.expand_dims(arr, 0))[0]
13
  idx = int(np.argmax(preds))
14
- return {"className": CLASS_NAMES[idx], "confidence": round(float(preds[idx]) * 100, 1)}
15
 
16
- demo = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="json")
17
- demo.launch()
 
 
 
 
 
 
11
  arr = (np.array(img, dtype=np.float32) / 127.5) - 1.0
12
  preds = model.predict(np.expand_dims(arr, 0))[0]
13
  idx = int(np.argmax(preds))
14
+ return {CLASS_NAMES[i]: float(preds[i]) for i in range(len(CLASS_NAMES))}
15
 
16
+ demo = gr.Interface(
17
+ fn=predict,
18
+ inputs=gr.Image(type="pil"),
19
+ outputs=gr.Label(num_top_classes=3),
20
+ title="OralScan AI"
21
+ )
22
+ demo.launch()