Spaces:
Configuration error
Configuration error
Commit
·
58e75e2
1
Parent(s):
38e8c1b
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import tempfile
|
|
8 |
import shutil
|
9 |
import requests
|
10 |
from pathlib import Path
|
11 |
-
temp_dir =
|
12 |
global ckpt_temp_file
|
13 |
global audio_temp_file
|
14 |
global config_temp_file
|
@@ -68,7 +68,7 @@ ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
|
|
68 |
if ckpt is not None:
|
69 |
#TEMP FUNCTION
|
70 |
ckpt_temp_file = os.path.join(temp_dir.name, "ckpt_temp_file.ckpt")
|
71 |
-
with
|
72 |
bytes_data = ckpt.getvalue()
|
73 |
temp.write(bytes_data)
|
74 |
st.success("File saved to: {}".format(ckpt_temp_file))
|
@@ -87,7 +87,7 @@ config = st.file_uploader("Choose your config", type= 'yaml')
|
|
87 |
# Check if user uploaded a config file
|
88 |
if config is not None:
|
89 |
#TEMP FUNCTION
|
90 |
-
with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
|
91 |
# Get the file contents as bytes
|
92 |
bytes_data = config.getvalue()
|
93 |
# Write the bytes to the temporary file
|
@@ -105,7 +105,7 @@ audio = st.file_uploader("Choose your audio", type=["wav", "mp3"])
|
|
105 |
# Check if user uploaded an audio file
|
106 |
if audio is not None:
|
107 |
#TEMP FUNCTION
|
108 |
-
with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
|
109 |
# Get the file contents as bytes
|
110 |
bytes_data = audio.getvalue()
|
111 |
# Write the bytes to the temporary file
|
|
|
8 |
import shutil
|
9 |
import requests
|
10 |
from pathlib import Path
|
11 |
+
temp_dir = os.path.expanduser("~/app")
|
12 |
global ckpt_temp_file
|
13 |
global audio_temp_file
|
14 |
global config_temp_file
|
|
|
68 |
if ckpt is not None:
|
69 |
#TEMP FUNCTION
|
70 |
ckpt_temp_file = os.path.join(temp_dir.name, "ckpt_temp_file.ckpt")
|
71 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False, dir=temp_dir) as temp:
|
72 |
bytes_data = ckpt.getvalue()
|
73 |
temp.write(bytes_data)
|
74 |
st.success("File saved to: {}".format(ckpt_temp_file))
|
|
|
87 |
# Check if user uploaded a config file
|
88 |
if config is not None:
|
89 |
#TEMP FUNCTION
|
90 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False, dir=temp_dir) as temp:
|
91 |
# Get the file contents as bytes
|
92 |
bytes_data = config.getvalue()
|
93 |
# Write the bytes to the temporary file
|
|
|
105 |
# Check if user uploaded an audio file
|
106 |
if audio is not None:
|
107 |
#TEMP FUNCTION
|
108 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False, dir=temp_dir) as temp:
|
109 |
# Get the file contents as bytes
|
110 |
bytes_data = audio.getvalue()
|
111 |
# Write the bytes to the temporary file
|