Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,10 +6,6 @@ import mido, openai
|
|
6 |
|
7 |
if 'path' not in st.session_state:
|
8 |
st.session_state['path'] = os.path.realpath(os.path.dirname(__file__))
|
9 |
-
if 'fresh' not in st.session_state:
|
10 |
-
os.remove(os.path.join(st.session_state['path'], 'output.mid'))
|
11 |
-
os.remove(os.path.join(st.session_state['path'], 't2m.mid'))
|
12 |
-
st.session_state['fresh'] = False
|
13 |
if 'sessionID' not in st.session_state:
|
14 |
st.session_state['sessionID'] = random.randint(0,99999999)
|
15 |
if 'history' not in st.session_state:
|
@@ -124,8 +120,8 @@ with main:
|
|
124 |
st.warning('Make sure OpenAI key, prompt, and system prompt are entered', icon='⚠️')
|
125 |
with col4:
|
126 |
if st.session_state['downloadable']:
|
127 |
-
with open(os.path.join(st.session_state['path'], '
|
128 |
-
st.download_button('Download Midi', f, file_name='
|
129 |
if showOutput:
|
130 |
with st.container():
|
131 |
for i in st.session_state['history']:
|
@@ -166,4 +162,4 @@ with t2m:
|
|
166 |
with open(os.path.join(st.session_state['path'], 't2m.mid'), 'wb') as f:
|
167 |
song.writeFile(f)
|
168 |
with open(os.path.join(st.session_state['path'], 't2m.mid'), 'rb') as f:
|
169 |
-
st.download_button('Download Midi', f, file_name='
|
|
|
6 |
|
7 |
if 'path' not in st.session_state:
|
8 |
st.session_state['path'] = os.path.realpath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
|
9 |
if 'sessionID' not in st.session_state:
|
10 |
st.session_state['sessionID'] = random.randint(0,99999999)
|
11 |
if 'history' not in st.session_state:
|
|
|
120 |
st.warning('Make sure OpenAI key, prompt, and system prompt are entered', icon='⚠️')
|
121 |
with col4:
|
122 |
if st.session_state['downloadable']:
|
123 |
+
with open(os.path.join(st.session_state['path'], 'out.mid'), 'rb') as f:
|
124 |
+
st.download_button('Download Midi', f, file_name='out.mid')
|
125 |
if showOutput:
|
126 |
with st.container():
|
127 |
for i in st.session_state['history']:
|
|
|
162 |
with open(os.path.join(st.session_state['path'], 't2m.mid'), 'wb') as f:
|
163 |
song.writeFile(f)
|
164 |
with open(os.path.join(st.session_state['path'], 't2m.mid'), 'rb') as f:
|
165 |
+
st.download_button('Download Midi', f, file_name='out.mid')
|