Kangarroar commited on
Commit
81692a3
1 Parent(s): 7233a99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -47
app.py CHANGED
@@ -63,58 +63,51 @@ st.title('DIFF-SVC Render')
63
 
64
  ###CKPT LOADER
65
  ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
66
- # Check if user uploaded a CKPT file
67
- if ckpt is not None:
68
- #TEMP FUNCTION
69
- with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
70
- # Get the file contents as bytes
71
- bytes_data = ckpt.getvalue()
72
- # Write the bytes to the temporary file
73
- temp.write(bytes_data)
74
- ckpt_temp_file = temp.name
75
- # Print the temporary file name
76
- print(temp.name)
77
-
78
- # Display the file path
79
- if "ckpt_temp_file" in locals():
80
- st.success("File saved to: {}".format(ckpt_temp_file))
81
-
82
- # File uploader
83
- config = st.file_uploader("Choose your config", type= 'yaml')
84
-
85
- # Check if user uploaded a config file
86
- if config is not None:
87
- #TEMP FUNCTION
88
- with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
89
- # Get the file contents as bytes
90
- bytes_data = config.getvalue()
91
- # Write the bytes to the temporary file
92
- temp.write(bytes_data)
93
- config_temp_file = temp.name
94
- # Print the temporary file name
95
- print(temp.name)
96
-
97
- # Display the file path
98
- if "config_temp_file" in locals():
99
- st.success("File saved to: {}".format(config_temp_file))
100
-
101
- audio = st.file_uploader("Choose your audio", type=["wav", "mp3"])
102
-
103
- # Check if user uploaded an audio file
104
- if audio is not None:
105
  #TEMP FUNCTION
106
- with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
107
  # Get the file contents as bytes
108
- bytes_data = audio.getvalue()
109
  # Write the bytes to the temporary file
110
- temp.write(bytes_data)
111
- audio_temp_file = temp.name
112
  # Print the temporary file name
113
- print(temp.name)
114
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  # Display the file path
116
- if "audio_temp_file" in locals():
117
- st.success("File saved to: {}".format(audio_temp_file))
118
  # Add a text input for the title with a default value of 0
119
  title = st.text_input("Key", value="0")
120
  # Add a button to start the rendering process
 
63
 
64
  ###CKPT LOADER
65
  ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
66
+ # Check if user uploaded a CKPT file
67
+ if ckpt is not None:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  #TEMP FUNCTION
69
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
70
  # Get the file contents as bytes
71
+ bytes_data = ckpt.getvalue()
72
  # Write the bytes to the temporary file
73
+ temp.write(bytes_data)
74
+ ckpt_temp_file = temp.name
75
  # Print the temporary file name
76
+ print(temp.name)
77
+ # Display the file path
78
+ if "ckpt_temp_file" in locals():
79
+ st.success("File saved to: {}".format(ckpt_temp_file))
80
+ # File uploader
81
+ config = st.file_uploader("Choose your config", type= 'yaml')
82
+ # Check if user uploaded a config file
83
+ if config is not None:
84
+ #TEMP FUNCTION
85
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
86
+ # Get the file contents as bytes
87
+ bytes_data = config.getvalue()
88
+ # Write the bytes to the temporary file
89
+ temp.write(bytes_data)
90
+ config_temp_file = temp.name
91
+ # Print the temporary file name
92
+ print(temp.name)
93
+ # Display the file path
94
+ if "config_temp_file" in locals():
95
+ st.success("File saved to: {}".format(config_temp_file))
96
+ audio = st.file_uploader("Choose your audio", type=["wav", "mp3"])
97
+ # Check if user uploaded an audio file
98
+ if audio is not None:
99
+ #EMP FUNCTION
100
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
101
+ # Get the file contents as bytes
102
+ bytes_data = audio.getvalue()
103
+ # Write the bytes to the temporary file
104
+ temp.write(bytes_data)
105
+ audio_temp_file = temp.name
106
+ # Print the temporary file name
107
+ print(temp.name)
108
  # Display the file path
109
+ if "audio_temp_file" in locals():
110
+ st.success("File saved to: {}".format(audio_temp_file))
111
  # Add a text input for the title with a default value of 0
112
  title = st.text_input("Key", value="0")
113
  # Add a button to start the rendering process