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