Spaces:
Runtime error
Runtime error
kurianbenoy
commited on
Commit
•
bbdbdcc
1
Parent(s):
34a8f74
add credits
Browse files- app.py +3 -0
- article.md +7 -1
app.py
CHANGED
@@ -26,6 +26,7 @@ interface_options = {
|
|
26 |
"examples": ["000003.ogg", "000032.ogg", "000038.ogg", "000050.ogg", "000103.ogg"],
|
27 |
}
|
28 |
|
|
|
29 |
N_FFT = 2048
|
30 |
HOP_LEN = 1024
|
31 |
|
@@ -58,9 +59,11 @@ def create_image(filename):
|
|
58 |
save_image(specgram, "temp.png")
|
59 |
|
60 |
|
|
|
61 |
def predict(img):
|
62 |
img = PILImage.create(img)
|
63 |
_pred, _pred_w_idx, probs = model.predict(img)
|
|
|
64 |
labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}
|
65 |
return labels_probs
|
66 |
|
|
|
26 |
"examples": ["000003.ogg", "000032.ogg", "000038.ogg", "000050.ogg", "000103.ogg"],
|
27 |
}
|
28 |
|
29 |
+
## Code from Dien Hoa Truong inference notebook: https://www.kaggle.com/code/dienhoa/inference-submission-music-genre
|
30 |
N_FFT = 2048
|
31 |
HOP_LEN = 1024
|
32 |
|
|
|
59 |
save_image(specgram, "temp.png")
|
60 |
|
61 |
|
62 |
+
# Code from: https://huggingface.co/spaces/suvash/food-101-resnet50
|
63 |
def predict(img):
|
64 |
img = PILImage.create(img)
|
65 |
_pred, _pred_w_idx, probs = model.predict(img)
|
66 |
+
# gradio doesn't support tensors, so convertings to foloat
|
67 |
labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}
|
68 |
return labels_probs
|
69 |
|
article.md
CHANGED
@@ -35,4 +35,10 @@ The example images provided in the demo are from the validation data from Kaggle
|
|
35 |
|
36 |
## Credits
|
37 |
|
38 |
-
Thanks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
## Credits
|
37 |
|
38 |
+
Thanks [Dien Hoa Truong code](https://www.kaggle.com/code/dienhoa/inference-submission-music-genre) for creating end to end pipeline for code.
|
39 |
+
|
40 |
+
Thanks [@suvash](https://twitter.com/suvash) for helping me get started with huggingface
|
41 |
+
spaces and for his [excellent space](https://huggingface.co/spaces/suvash/food-101-resnet50) which was a reference for this work.
|
42 |
+
|
43 |
+
Thanks [@strickvl](https://twitter.com/strickvl) for reporting issue in safari browser
|
44 |
+
and trying this space out.
|