import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import json import tempfile import shutil temp_dir = tempfile.mkdtemp() ##### PAGE CONFIG def printthings(): print(ckpt) print(config) print(audio) print(gflag) st.set_page_config( page_title="DiffSVC Render", page_icon="🧊", initial_sidebar_state="expanded", ) ############ st.title('DIFF-SVC Render') col1, col2 = st.columns([2, 1]) with col1: ###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) # Print the temporary file name print(temp.name) ###CONFIG LOADER config = st.file_uploader("Choose your config", type= 'yaml') 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) # Print the temporary file name print(temp.name) ##WAV LOADER audio = st.file_uploader("Choose your audio", type= 'wav' or 'mp3') if audio is not None: #TEMP 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) # Print the temporary file name print(temp.name) gflag = st.slider('Gender Flag', 0.80, 1.20, 1.00) with col2: ###DOWNLOAD text_contents = '''This is some text''' st.download_button('Download Rendered File', text_contents) st.button('Test', on_click=printthings)