File size: 2,454 Bytes
53bbad7
cd8ed16
b771526
 
 
 
 
 
 
53bbad7
b771526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3d9e8a0
96e9f41
b771526
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import streamlit as st
import os
st.set_page_config(
    page_title="DiffSVC Render",
    page_icon="🧊",
    initial_sidebar_state="expanded",
)
############
st.title('DIFF-SVC Render')

###CKPT LOADER
ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
# Check if user uploaded a CKPT file
if ckpt is not None:
  #TEMP FUNCTION
  with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
    # Get the file contents as bytes
    bytes_data = ckpt.getvalue()
    # Write the bytes to the temporary file
    temp.write(bytes_data)
    ckpt_temp_file = temp.name
    # Print the temporary file name
    print(temp.name)
# Display the file path
if "ckpt_temp_file" in locals():
    st.success("File saved to: {}".format(ckpt_temp_file))
# File uploader
config = st.file_uploader("Choose your config", type= 'yaml')
# Check if user uploaded a config file
if config is not None:
  #TEMP FUNCTION
  with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
    # Get the file contents as bytes
    bytes_data = config.getvalue()
    # Write the bytes to the temporary file
    temp.write(bytes_data)
    config_temp_file = temp.name
    # Print the temporary file name
    print(temp.name)
# Display the file path
if "config_temp_file" in locals():
    st.success("File saved to: {}".format(config_temp_file))
audio = st.file_uploader("Choose your audio", type=["wav"])
# Check if user uploaded an audio file
if audio is not None:
#EMP FUNCTION
  with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
# Get the file contents as bytes
    bytes_data = audio.getvalue()
# Write the bytes to the temporary file
    temp.write(bytes_data)
    audio_temp_file = temp.name
# Print the temporary file name
    print(temp.name)
# Display the file path
if "audio_temp_file" in locals():
    st.success("File saved to: {}".format(audio_temp_file))
# Add a text input for the title with a default value of 0
title = st.text_input("Key", value="0")
title2 = st.text_input("Speedup", value="20")
password = st.text_input("Enter password")
correct_password = os.environ.get("gatepassword")
# Add a button to start the rendering process
# Add a button to start the rendering process
if st.button("Render audio"):
    if password == correct_password:
        render_audio(ckpt_temp_file, config_temp_file, audio_temp_file, title, title2)
  
    else:
        st.error("Incorrect password")