Spaces:
Configuration error
Configuration error
Commit
·
2213d3a
1
Parent(s):
6164971
Update streamlitpoe.py
Browse files- streamlitpoe.py +40 -3
streamlitpoe.py
CHANGED
|
@@ -4,7 +4,8 @@ import numpy as np
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
import json
|
| 6 |
import tempfile
|
| 7 |
-
|
|
|
|
| 8 |
##### PAGE CONFIG
|
| 9 |
def printthings():
|
| 10 |
print(ckpt)
|
|
@@ -25,10 +26,46 @@ col1, col2 = st.columns([2, 1])
|
|
| 25 |
with col1:
|
| 26 |
###CKPT LOADER
|
| 27 |
ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
config = st.file_uploader("Choose your config", type= 'yaml')
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
audio = st.file_uploader("Choose your audio", type= 'wav' or 'mp3')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
gflag = st.slider('Gender Flag', 0.80, 1.20, 1.00)
|
| 33 |
|
| 34 |
with col2:
|
|
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
import json
|
| 6 |
import tempfile
|
| 7 |
+
import shutil
|
| 8 |
+
temp_dir = tempfile.mkdtemp()
|
| 9 |
##### PAGE CONFIG
|
| 10 |
def printthings():
|
| 11 |
print(ckpt)
|
|
|
|
| 26 |
with col1:
|
| 27 |
###CKPT LOADER
|
| 28 |
ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
|
| 29 |
+
# Check if user uploaded a CKPT file
|
| 30 |
+
if ckpt is not None:
|
| 31 |
+
#TEMP FUNCTION
|
| 32 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
|
| 33 |
+
# Get the file contents as bytes
|
| 34 |
+
bytes_data = ckpt.getvalue()
|
| 35 |
+
|
| 36 |
+
# Write the bytes to the temporary file
|
| 37 |
+
temp.write(bytes_data)
|
| 38 |
+
|
| 39 |
+
# Print the temporary file name
|
| 40 |
+
print(temp.name)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
###CONFIG LOADER
|
| 44 |
config = st.file_uploader("Choose your config", type= 'yaml')
|
| 45 |
+
if config is not None:
|
| 46 |
+
#TEMP FUNCTION
|
| 47 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
|
| 48 |
+
# Get the file contents as bytes
|
| 49 |
+
bytes_data = config.getvalue()
|
| 50 |
+
|
| 51 |
+
# Write the bytes to the temporary file
|
| 52 |
+
temp.write(bytes_data)
|
| 53 |
+
|
| 54 |
+
# Print the temporary file name
|
| 55 |
+
print(temp.name)
|
| 56 |
+
##WAV LOADER
|
| 57 |
audio = st.file_uploader("Choose your audio", type= 'wav' or 'mp3')
|
| 58 |
+
if audio is not None:
|
| 59 |
+
#TEMP FUNCTION
|
| 60 |
+
with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
|
| 61 |
+
# Get the file contents as bytes
|
| 62 |
+
bytes_data = audio.getvalue()
|
| 63 |
+
|
| 64 |
+
# Write the bytes to the temporary file
|
| 65 |
+
temp.write(bytes_data)
|
| 66 |
+
|
| 67 |
+
# Print the temporary file name
|
| 68 |
+
print(temp.name)
|
| 69 |
gflag = st.slider('Gender Flag', 0.80, 1.20, 1.00)
|
| 70 |
|
| 71 |
with col2:
|