slslslrhfem commited on
Commit ·
b4eefc1
1
Parent(s): 8cc61fd
change import order
Browse files- app.py +3 -3
- inference.py +1 -11
app.py
CHANGED
|
@@ -22,8 +22,7 @@ def install_madmom():
|
|
| 22 |
|
| 23 |
install_madmom()
|
| 24 |
|
| 25 |
-
|
| 26 |
-
from inference import inference
|
| 27 |
|
| 28 |
def download_data_from_hub():
|
| 29 |
base_dir = Path(".")
|
|
@@ -330,7 +329,8 @@ h1 {
|
|
| 330 |
print("Starting Music Plagiarism Detection App...")
|
| 331 |
print("Downloading covers80 and ml_models folders...")
|
| 332 |
folders = download_data_from_hub()
|
| 333 |
-
|
|
|
|
| 334 |
if folders.get("covers80") and folders.get("ml_models"):
|
| 335 |
print("All required data folders are ready")
|
| 336 |
elif folders.get("covers80") or folders.get("ml_models"):
|
|
|
|
| 22 |
|
| 23 |
install_madmom()
|
| 24 |
|
| 25 |
+
|
|
|
|
| 26 |
|
| 27 |
def download_data_from_hub():
|
| 28 |
base_dir = Path(".")
|
|
|
|
| 329 |
print("Starting Music Plagiarism Detection App...")
|
| 330 |
print("Downloading covers80 and ml_models folders...")
|
| 331 |
folders = download_data_from_hub()
|
| 332 |
+
# Import inference - any error will bubble up
|
| 333 |
+
from inference import inference
|
| 334 |
if folders.get("covers80") and folders.get("ml_models"):
|
| 335 |
print("All required data folders are ready")
|
| 336 |
elif folders.get("covers80") or folders.get("ml_models"):
|
inference.py
CHANGED
|
@@ -56,14 +56,4 @@ def result_formatting(result):
|
|
| 56 |
return {
|
| 57 |
'matches': top_3_results,
|
| 58 |
'message': 'success'
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
if __name__ == "__main__":
|
| 63 |
-
result = inference("/home/ubuntu/data/coding/icassp-plagiarism-demo/KEON <3 - I GASLIGHT MYSELF | Udio [The%20Untitled].mp3")
|
| 64 |
-
print("Inference Result:")
|
| 65 |
-
for match in result['matches']:
|
| 66 |
-
print(f"Rank {match['rank']}: {match['song_title']}")
|
| 67 |
-
print(f" Score: {match['confidence']}")
|
| 68 |
-
print(f" Time Match: {match['time_match']}")
|
| 69 |
-
print()
|
|
|
|
| 56 |
return {
|
| 57 |
'matches': top_3_results,
|
| 58 |
'message': 'success'
|
| 59 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|