Spaces:
Running
Running
Fabio Grasso
commited on
Commit
·
d96c042
1
Parent(s):
839bbc6
fix: remove clean folders
Browse files- app/main.py +9 -9
app/main.py
CHANGED
@@ -44,13 +44,13 @@ def find_files(in_path):
|
|
44 |
out_path = Path("separated")
|
45 |
in_path = Path("tmp_in")
|
46 |
|
47 |
-
def clean_folders():
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
def url_is_valid(url):
|
56 |
import requests
|
@@ -85,14 +85,14 @@ def run():
|
|
85 |
# check if the url is valid
|
86 |
if url_is_valid(url):
|
87 |
with st.spinner("Downloading audio..."):
|
88 |
-
clean_folders()
|
89 |
filename = url.split("/")[-1]
|
90 |
os.system(f"wget -O {in_path / filename} {url}")
|
91 |
|
92 |
elif choice == "⬆️ Upload File":
|
93 |
uploaded_file = st.file_uploader("Choose a file")
|
94 |
if uploaded_file is not None:
|
95 |
-
clean_folders()
|
96 |
with open(in_path / uploaded_file.name, "wb") as f:
|
97 |
f.write(uploaded_file.getbuffer())
|
98 |
filename = uploaded_file.name
|
|
|
44 |
out_path = Path("separated")
|
45 |
in_path = Path("tmp_in")
|
46 |
|
47 |
+
# def clean_folders():
|
48 |
+
# if in_path.exists():
|
49 |
+
# rmtree(in_path)
|
50 |
+
# in_path.mkdir()
|
51 |
+
# if out_path.exists():
|
52 |
+
# rmtree(out_path)
|
53 |
+
# out_path.mkdir()
|
54 |
|
55 |
def url_is_valid(url):
|
56 |
import requests
|
|
|
85 |
# check if the url is valid
|
86 |
if url_is_valid(url):
|
87 |
with st.spinner("Downloading audio..."):
|
88 |
+
#clean_folders()
|
89 |
filename = url.split("/")[-1]
|
90 |
os.system(f"wget -O {in_path / filename} {url}")
|
91 |
|
92 |
elif choice == "⬆️ Upload File":
|
93 |
uploaded_file = st.file_uploader("Choose a file")
|
94 |
if uploaded_file is not None:
|
95 |
+
#clean_folders()
|
96 |
with open(in_path / uploaded_file.name, "wb") as f:
|
97 |
f.write(uploaded_file.getbuffer())
|
98 |
filename = uploaded_file.name
|