Zeyadd-Mostaffa commited on
Commit
4f11784
·
verified ·
1 Parent(s): abc9bfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -40,17 +40,18 @@ def predict(image_path):
40
 
41
  label = "Real" if avg_pred > 0.5 else "Fake"
42
 
43
- return {
44
- "label": label,
45
- "average": round(avg_pred, 3),
46
- "xception": round(xcp_pred, 3),
47
- "efficientnet": round(eff_pred, 3)
48
- }
 
49
 
50
  iface = gr.Interface(
51
  fn=predict,
52
  inputs=gr.Image(type="filepath"),
53
- outputs=gr.JSON(), # ✅ Now it actually returns a dict
54
  live=False
55
  )
56
 
 
40
 
41
  label = "Real" if avg_pred > 0.5 else "Fake"
42
 
43
+ return {"result": {
44
+ "label": label,
45
+ "average": round(avg_pred, 3),
46
+ "xception": round(xcp_pred, 3),
47
+ "efficientnet": round(eff_pred, 3)
48
+ }}
49
+
50
 
51
  iface = gr.Interface(
52
  fn=predict,
53
  inputs=gr.Image(type="filepath"),
54
+ outputs=gr.JSON(label="Prediction"), # ✅ Now it actually returns a dict
55
  live=False
56
  )
57