salma-mahjoub commited on
Commit
c19c852
·
1 Parent(s): 8a61b15

Fix: Update Gradio 6.x API endpoint configuration

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -27,7 +27,7 @@ def recommend_outfit_api(clothes_json: str, preference: str, city: str = "Tunis"
27
  except Exception as e:
28
  return json.dumps({"success": False, "error": str(e)})
29
 
30
- # ✅ Interface Gradio - gr.Interface est plus fiable pour l'API
31
  iface = gr.Interface(
32
  fn=recommend_outfit_api,
33
  inputs=[
@@ -53,8 +53,9 @@ iface = gr.Interface(
53
  "Tunis"
54
  ]
55
  ],
56
- # ✅ Pour Gradio 6.x, l'endpoint standard est /run/predict (pas besoin d'api_name)
57
- # L'API est automatiquement exposée via /run/predict
 
58
  )
59
 
60
  # ✅ Lancement de l'interface
 
27
  except Exception as e:
28
  return json.dumps({"success": False, "error": str(e)})
29
 
30
+ # ✅ Interface Gradio - gr.Interface avec api_name explicite pour Gradio 6.x
31
  iface = gr.Interface(
32
  fn=recommend_outfit_api,
33
  inputs=[
 
53
  "Tunis"
54
  ]
55
  ],
56
+ # ✅ CRUCIAL : api_name est nécessaire pour Gradio 6.x
57
+ # Cela expose l'endpoint /api/predict
58
+ api_name="predict"
59
  )
60
 
61
  # ✅ Lancement de l'interface