Kangarroar commited on
Commit
b771526
·
1 Parent(s): c0b97e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -32
app.py CHANGED
@@ -1,35 +1,70 @@
1
  import streamlit as st
2
  import os
3
- password = os.environ.get("password")
4
- # Define a function to hide a Streamlit tab
5
- def hide_tab():
6
- hide_streamlit_style = """
7
- <style>
8
- #MainMenu {visibility: hidden;}
9
- footer {visibility: hidden;}
10
- </style>
11
- """
12
- st.markdown(hide_streamlit_style, unsafe_allow_html=True)
13
 
14
- # Define a function to show a Streamlit tab
15
- def show_tab():
16
- show_streamlit_style = """
17
- <style>
18
- #MainMenu {visibility: visible;}
19
- footer {visibility: visible;}
20
- </style>
21
- """
22
- st.markdown(show_streamlit_style, unsafe_allow_html=True)
23
-
24
- # Hide the Streamlit tab by default
25
- hide_tab()
26
-
27
- # Create a button to show the hidden tab
28
- if st.button('Show tab'):
29
- show_tab()
30
- # Add content to the tab
31
- st.write('This is a hidden tab. You can now see it!')
32
- st.write(f"Password: {password}")
33
- # Create a button to hide the tab again
34
- if st.button('Hide tab'):
35
- hide_tab()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import os
3
+ st.set_page_config(
4
+ page_title="DiffSVC Render",
5
+ page_icon="🧊",
6
+ initial_sidebar_state="expanded",
7
+ )
8
+ ############
9
+ st.title('DIFF-SVC Render')
 
 
 
10
 
11
+ ###CKPT LOADER
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
+ if 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")