Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,12 +2,13 @@ import gradio as gr
|
|
| 2 |
from fastai.vision.all import *
|
| 3 |
import platform
|
| 4 |
import pathlib
|
|
|
|
| 5 |
|
| 6 |
# Correction des chemins pour Windows sur Linux
|
| 7 |
if platform.system() == 'Linux':
|
| 8 |
pathlib.WindowsPath = pathlib.PosixPath
|
| 9 |
|
| 10 |
-
#
|
| 11 |
learn = load_learner('export.pkl')
|
| 12 |
labels = learn.dls.vocab
|
| 13 |
|
|
@@ -35,5 +36,17 @@ app = gr.Interface(
|
|
| 35 |
app.launch(
|
| 36 |
server_name="0.0.0.0",
|
| 37 |
server_port=7860,
|
| 38 |
-
# share=True #
|
| 39 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from fastai.vision.all import *
|
| 3 |
import platform
|
| 4 |
import pathlib
|
| 5 |
+
import traceback # Importez ceci
|
| 6 |
|
| 7 |
# Correction des chemins pour Windows sur Linux
|
| 8 |
if platform.system() == 'Linux':
|
| 9 |
pathlib.WindowsPath = pathlib.PosixPath
|
| 10 |
|
| 11 |
+
# Charger le modèle
|
| 12 |
learn = load_learner('export.pkl')
|
| 13 |
labels = learn.dls.vocab
|
| 14 |
|
|
|
|
| 36 |
app.launch(
|
| 37 |
server_name="0.0.0.0",
|
| 38 |
server_port=7860,
|
| 39 |
+
# share=True # Assurez-vous que cette ligne est bien commentée ou supprimée !
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# ====================================================================
|
| 43 |
+
# IMPORTANT : Testez la fonction predict_api directement via l'interface web Gradio si possible
|
| 44 |
+
# Normalement, votre `app` (qui est un gr.Interface) expose déjà /api/predict
|
| 45 |
+
#
|
| 46 |
+
# Voici comment vous pouvez appeler cette API via votre navigateur (outil POSTMAN ou CURL) :
|
| 47 |
+
# URL: https://saifox-skin-problems-analyzer.hf.space/api/predict
|
| 48 |
+
# Méthode: POST
|
| 49 |
+
# Type de Contenu: multipart/form-data
|
| 50 |
+
# Champ de fichier: 'file' (nom du champ)
|
| 51 |
+
# Valeur du champ: votre fichier image
|
| 52 |
+
# ====================================================================
|