Spaces:
Running
Running
Ashhar
commited on
Commit
·
5d68a5f
1
Parent(s):
857cbb4
first commit
Browse files- .gitignore +6 -0
- README.md +3 -30
- app.py +46 -20
- requirements.txt +6 -5
.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.env
|
2 |
+
.venv
|
3 |
+
__pycache__/
|
4 |
+
.gitattributes
|
5 |
+
gradio_cached_examples/
|
6 |
+
app_*.py
|
README.md
CHANGED
@@ -1,38 +1,11 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: red
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
app_file: app.py
|
8 |
pinned: true
|
9 |
-
duplicated_from: Thafx/Demucs_v4_2s_HT
|
10 |
---
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
`title`: _string_
|
15 |
-
Display title for the Space
|
16 |
-
|
17 |
-
`emoji`: _string_
|
18 |
-
Space emoji (emoji-only character allowed)
|
19 |
-
|
20 |
-
`colorFrom`: _string_
|
21 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
22 |
-
|
23 |
-
`colorTo`: _string_
|
24 |
-
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
25 |
-
|
26 |
-
`sdk`: _string_
|
27 |
-
Can be either `gradio` or `streamlit`
|
28 |
-
|
29 |
-
`sdk_version` : _string_
|
30 |
-
Only applicable for `streamlit` SDK.
|
31 |
-
See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
|
32 |
-
|
33 |
-
`app_file`: _string_
|
34 |
-
Path to your main application file (which contains either `gradio` or `streamlit` Python code).
|
35 |
-
Path is relative to the root of the repository.
|
36 |
-
|
37 |
-
`pinned`: _boolean_
|
38 |
-
Whether the Space stays on top of your list.
|
|
|
1 |
---
|
2 |
+
title: Music Source Separation
|
3 |
+
emoji: 🎶
|
4 |
colorFrom: red
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
app_file: app.py
|
8 |
pinned: true
|
|
|
9 |
---
|
10 |
|
11 |
+
Duplicated from https://huggingface.co/spaces/abidlabs/music-separation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -1,21 +1,47 @@
|
|
1 |
-
import os
|
2 |
import gradio as gr
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import datetime as DT
|
3 |
+
import pytz
|
4 |
+
from gradio_client import Client
|
5 |
+
|
6 |
+
ipAddress = None
|
7 |
+
|
8 |
+
|
9 |
+
def __nowInIST():
|
10 |
+
return DT.datetime.now(pytz.timezone("Asia/Kolkata"))
|
11 |
+
|
12 |
+
|
13 |
+
def __attachIp(request: gr.Request):
|
14 |
+
global ipAddress
|
15 |
+
x_forwarded_for = request.headers.get('x-forwarded-for')
|
16 |
+
if x_forwarded_for:
|
17 |
+
ipAddress = x_forwarded_for
|
18 |
+
|
19 |
+
|
20 |
+
def pprint(log: str):
|
21 |
+
now = __nowInIST()
|
22 |
+
now = now.strftime("%Y-%m-%d %H:%M:%S")
|
23 |
+
print(f"[{now}] [{ipAddress}] {log}")
|
24 |
+
|
25 |
+
|
26 |
+
def predict(audio):
|
27 |
+
client = Client("https://abidlabs-music-separation.hf.space/")
|
28 |
+
result = client.predict(
|
29 |
+
audio,
|
30 |
+
api_name="/predict"
|
31 |
+
)
|
32 |
+
return result
|
33 |
+
|
34 |
+
|
35 |
+
with gr.Interface(
|
36 |
+
predict,
|
37 |
+
inputs=gr.Audio(type="filepath", label="Input"),
|
38 |
+
outputs=[
|
39 |
+
gr.Audio(type="filepath", label="Vocals"),
|
40 |
+
gr.Audio(type="filepath", label="No Vocals / Instrumental")
|
41 |
+
],
|
42 |
+
title="Split your song into vocals & music",
|
43 |
+
article="<p style='text-align: center'>Credits: <a href: 'https://huggingface.co/spaces/abidlabs/music-separation'>abidlabs/music-separation</a> </>",
|
44 |
+
) as demo:
|
45 |
+
demo.load(__attachIp, None, None)
|
46 |
+
|
47 |
+
demo.launch(debug=True)
|
requirements.txt
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
-
git+https://github.com/facebookresearch/demucs#egg=demucs
|
2 |
-
scipy
|
3 |
-
invisible-watermark
|
4 |
-
fonts
|
5 |
-
font-roboto
|
|
|
6 |
|
7 |
|
|
|
1 |
+
# git+https://github.com/facebookresearch/demucs#egg=demucs
|
2 |
+
# scipy
|
3 |
+
# invisible-watermark
|
4 |
+
# fonts
|
5 |
+
# font-roboto
|
6 |
+
# gradio_client
|
7 |
|
8 |
|