Spaces:
Runtime error
Runtime error
Kangarroar
commited on
Commit
·
b951c81
1
Parent(s):
96e9f41
Update app.py
Browse files
app.py
CHANGED
@@ -1,70 +1,21 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
-
st
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
)
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
|
13 |
-
# Check if user uploaded a CKPT file
|
14 |
-
if ckpt is not None:
|
15 |
-
#TEMP FUNCTION
|
16 |
-
with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
|
17 |
-
# Get the file contents as bytes
|
18 |
-
bytes_data = ckpt.getvalue()
|
19 |
-
# Write the bytes to the temporary file
|
20 |
-
temp.write(bytes_data)
|
21 |
-
ckpt_temp_file = temp.name
|
22 |
-
# Print the temporary file name
|
23 |
-
print(temp.name)
|
24 |
-
# Display the file path
|
25 |
-
if "ckpt_temp_file" in locals():
|
26 |
-
st.success("File saved to: {}".format(ckpt_temp_file))
|
27 |
-
# File uploader
|
28 |
-
config = st.file_uploader("Choose your config", type= 'yaml')
|
29 |
-
# Check if user uploaded a config file
|
30 |
-
if config is not None:
|
31 |
-
#TEMP FUNCTION
|
32 |
-
with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
|
33 |
-
# Get the file contents as bytes
|
34 |
-
bytes_data = config.getvalue()
|
35 |
-
# Write the bytes to the temporary file
|
36 |
-
temp.write(bytes_data)
|
37 |
-
config_temp_file = temp.name
|
38 |
-
# Print the temporary file name
|
39 |
-
print(temp.name)
|
40 |
-
# Display the file path
|
41 |
-
if "config_temp_file" in locals():
|
42 |
-
st.success("File saved to: {}".format(config_temp_file))
|
43 |
-
audio = st.file_uploader("Choose your audio", type=["wav"])
|
44 |
-
# Check if user uploaded an audio file
|
45 |
-
if audio is not None:
|
46 |
-
#EMP FUNCTION
|
47 |
-
with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
|
48 |
-
# Get the file contents as bytes
|
49 |
-
bytes_data = audio.getvalue()
|
50 |
-
# Write the bytes to the temporary file
|
51 |
-
temp.write(bytes_data)
|
52 |
-
audio_temp_file = temp.name
|
53 |
-
# Print the temporary file name
|
54 |
-
print(temp.name)
|
55 |
-
# Display the file path
|
56 |
-
if "audio_temp_file" in locals():
|
57 |
-
st.success("File saved to: {}".format(audio_temp_file))
|
58 |
-
# Add a text input for the title with a default value of 0
|
59 |
-
title = st.text_input("Key", value="0")
|
60 |
-
title2 = st.text_input("Speedup", value="20")
|
61 |
-
password = st.text_input("Enter password")
|
62 |
-
correct_password = os.environ.get("gatepassword")
|
63 |
-
# Add a button to start the rendering process
|
64 |
-
# Add a button to start the rendering process
|
65 |
-
if st.button("Render audio"):
|
66 |
-
if password == correct_password:
|
67 |
-
render_audio(ckpt_temp_file, config_temp_file, audio_temp_file, title, title2)
|
68 |
-
|
69 |
-
else:
|
70 |
-
st.error("Incorrect password")
|
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
# First row
|
6 |
+
col1, col2 = st.beta_columns(2)
|
7 |
+
col1.title('DIFF-SVC Render')
|
8 |
+
|
9 |
+
# Second row
|
10 |
+
col1, col2 = st.beta_columns(2)
|
11 |
+
ckpt = col1.file_uploader("Choose your CKPT", type= 'ckpt')
|
12 |
+
config = col1.file_uploader("Choose your config", type= 'yaml')
|
13 |
+
audio = col1.file_uploader("Choose your audio", type=["wav"])
|
14 |
+
|
15 |
+
# Third row
|
16 |
+
col1, col2 = st.beta_columns(2)
|
17 |
+
title = col2.text_input("Key", value="0")
|
18 |
+
title2 = col2.text_input("Speedup", value="20")
|
19 |
+
password = col2.text_input("Enter password")
|
20 |
|
21 |
+
# Rest of the code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|