update app.py
Browse files
app.py
CHANGED
|
@@ -193,11 +193,19 @@ def preprocess_sound(df):
|
|
| 193 |
# -------- Gradio --------
|
| 194 |
def predict_with_metadata(url):
|
| 195 |
if url.strip() == "":
|
| 196 |
-
return "
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
df_processed = preprocess_sound(
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
with gr.Blocks(title="FreeSound Popularity Detector") as demo:
|
| 203 |
gr.Markdown("# 🎧 FreeSound Popularity Detector")
|
|
|
|
| 193 |
# -------- Gradio --------
|
| 194 |
def predict_with_metadata(url):
|
| 195 |
if url.strip() == "":
|
| 196 |
+
return " Veuillez entrer une URL FreeSound."
|
| 197 |
+
df_raw = fetch_sound_metadata(url)
|
| 198 |
+
raw_str = "=== Métadonnées brutes ===\n" + df_raw.to_string(index=False)
|
| 199 |
+
df_processed = preprocess_sound(df_raw)
|
| 200 |
+
|
| 201 |
+
if isinstance(df_processed, pd.DataFrame):
|
| 202 |
+
processed_str = "\n\n=== Features après preprocessing ===\n" + df_processed.to_string(index=False)
|
| 203 |
+
else:
|
| 204 |
+
processed_str = "\n\n" + df_processed # message d'erreur déjà string
|
| 205 |
+
|
| 206 |
+
return raw_str + processed_str
|
| 207 |
+
|
| 208 |
+
|
| 209 |
|
| 210 |
with gr.Blocks(title="FreeSound Popularity Detector") as demo:
|
| 211 |
gr.Markdown("# 🎧 FreeSound Popularity Detector")
|