Kangarroar commited on
Commit
1712e17
1 Parent(s): 53bbad7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -27
app.py CHANGED
@@ -1,36 +1,66 @@
1
  import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
 
5
- st.title('Uber pickups in NYC')
6
 
7
- DATE_COLUMN = 'date/time'
8
- DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
9
- 'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
10
 
11
- @st.cache
12
- def load_data(nrows):
13
- data = pd.read_csv(DATA_URL, nrows=nrows)
14
- lowercase = lambda x: str(x).lower()
15
- data.rename(lowercase, axis='columns', inplace=True)
16
- data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
17
- return data
 
 
 
 
18
 
19
- data_load_state = st.text('Loading data...')
20
- data = load_data(10000)
21
- data_load_state.text("Done! (using st.cache)")
22
 
23
- if st.checkbox('Show raw data'):
24
- st.subheader('Raw data')
25
- st.write(data)
26
 
27
- st.subheader('Number of pickups by hour')
28
- hist_values = np.histogram(data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
29
- st.bar_chart(hist_values)
 
 
 
 
 
 
 
 
30
 
31
- # Some number in the range 0-23
32
- hour_to_filter = st.slider('hour', 0, 23, 17)
33
- filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
34
 
35
- st.subheader('Map of all pickups at %s:00' % hour_to_filter)
36
- st.map(filtered_data)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
 
 
2
 
3
+ st.title('DIFF-SVC Render')
4
 
5
+ ###CKPT LOADER
6
+ # File uploader
7
+ ckpt = st.file_uploader("Choose your CKPT", type= 'ckpt')
8
 
9
+ # Check if user uploaded a CKPT file
10
+ if ckpt is not None:
11
+ #TEMP FUNCTION
12
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.ckpt', delete=False) as temp:
13
+ # Get the file contents as bytes
14
+ bytes_data = ckpt.getvalue()
15
+ # Write the bytes to the temporary file
16
+ temp.write(bytes_data)
17
+ ckpt_temp_file = temp.name
18
+ # Print the temporary file name
19
+ print(temp.name)
20
 
21
+ # Display the file path
22
+ if "ckpt_temp_file" in locals():
23
+ st.success("File saved to: {}".format(ckpt_temp_file))
24
 
25
+ # File uploader
26
+ config = st.file_uploader("Choose your config", type= 'yaml')
 
27
 
28
+ # Check if user uploaded a config file
29
+ if config is not None:
30
+ #TEMP FUNCTION
31
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.yaml', delete=False) as temp:
32
+ # Get the file contents as bytes
33
+ bytes_data = config.getvalue()
34
+ # Write the bytes to the temporary file
35
+ temp.write(bytes_data)
36
+ config_temp_file = temp.name
37
+ # Print the temporary file name
38
+ print(temp.name)
39
 
40
+ # Display the file path
41
+ if "config_temp_file" in locals():
42
+ st.success("File saved to: {}".format(config_temp_file))
43
 
44
+ # File uploader
45
+ audio = st.file_uploader("Choose your audio", type=["wav", "mp3"])
46
+
47
+ # Check if user uploaded an audio file
48
+ if audio is not None:
49
+ #TEMP FUNCTION
50
+ with tempfile.NamedTemporaryFile(mode="wb", suffix='.wav', delete=False) as temp:
51
+ # Get the file contents as bytes
52
+ bytes_data = audio.getvalue()
53
+ # Write the bytes to the temporary file
54
+ temp.write(bytes_data)
55
+ audio_temp_file = temp.name
56
+ # Print the temporary file name
57
+ print(temp.name)
58
+
59
+ # Display the file path
60
+ if "audio_temp_file" in locals():
61
+ st.success("File saved to: {}".format(audio_temp_file))
62
+ # Add a text input for the title with a default value of 0
63
+ title = st.text_input("Key", value="0")
64
+ # Add a button to start the rendering process
65
+ if st.button("Render audio"):
66
+ print("done")