ccolas commited on
Commit
c844390
1 Parent(s): 8ee751f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -5
app.py CHANGED
@@ -15,7 +15,7 @@ from pretty_midi import PrettyMIDI
15
  import numpy as np
16
  import pydub
17
  from PIL import Image
18
-
19
 
20
  st.set_page_config(
21
  page_title="TastyPiano",
@@ -38,6 +38,13 @@ def centered_button(func, text, args=None):
38
  return func(text)
39
 
40
  def setup_streamlite():
 
 
 
 
 
 
 
41
  setup_translation_models()
42
  image = Image.open('./data/pianocktail.jpg')
43
  st.image(image, caption='Pianocktail by Compagnie la Rumeur')
@@ -72,14 +79,16 @@ def setup_streamlite():
72
  midi = st.file_uploader("Upload it here (.mid)", type=['.mid'])
73
  generate_audio_from_midi = st.checkbox('Generate audio? Untick if the song is too long (>10min)', value=True)
74
 
 
 
 
75
  def run(unit):
76
  setup_and_run(unit=unit, url=url, midi=midi, audio=audio, generate_audio_from_midi=generate_audio_from_midi, extra_code=None)
77
- # url = "https://youtu.be/VUCI-1vIbUo"
78
- # unit = 'mL'
79
- # run(unit)
80
  st.markdown('##')
81
  unit = st.radio('Pick the units (before pressing "Taste it!", default mL)', ['mL', 'oz'], index=0)
82
  button = centered_button(st.button, 'Taste it!')
 
83
  if button:
84
  run(unit)
85
 
@@ -129,7 +138,7 @@ def setup_and_run(unit='mL', url=None, midi=None, audio=None, generate_audio_fro
129
  assert False
130
  st.subheader('Synesthesia')
131
  now = datetime.now()
132
- folder_name = f'{now.year}-{now.month}-{now.day}_{now.hour}:{now.minute}:{now.second}'
133
  folder_path = synestesia_path + folder_name
134
  if extra_code is not None:
135
  folder_path += '_' + extra_code
 
15
  import numpy as np
16
  import pydub
17
  from PIL import Image
18
+ import pytube
19
 
20
  st.set_page_config(
21
  page_title="TastyPiano",
 
38
  return func(text)
39
 
40
  def setup_streamlite():
41
+ path = '/'.join(pytube.__file__.split('/')[:-1]) + '/cipher.py'
42
+ with open(path, 'r') as f:
43
+ cipher = f.read().split('\n')
44
+ cipher[286] = cipher[286].replace('\\', '')
45
+ with open(path, 'w') as f:
46
+ f.write('\n'.join(cipher))
47
+ os.path.exists(path)
48
  setup_translation_models()
49
  image = Image.open('./data/pianocktail.jpg')
50
  st.image(image, caption='Pianocktail by Compagnie la Rumeur')
 
79
  midi = st.file_uploader("Upload it here (.mid)", type=['.mid'])
80
  generate_audio_from_midi = st.checkbox('Generate audio? Untick if the song is too long (>10min)', value=True)
81
 
82
+ #url = "https://www.youtube.com/watch?v=UGK70IkP830"
83
+ #unit# = 'mL'
84
+
85
  def run(unit):
86
  setup_and_run(unit=unit, url=url, midi=midi, audio=audio, generate_audio_from_midi=generate_audio_from_midi, extra_code=None)
87
+ #run(unit)
 
 
88
  st.markdown('##')
89
  unit = st.radio('Pick the units (before pressing "Taste it!", default mL)', ['mL', 'oz'], index=0)
90
  button = centered_button(st.button, 'Taste it!')
91
+ # print(url)
92
  if button:
93
  run(unit)
94
 
 
138
  assert False
139
  st.subheader('Synesthesia')
140
  now = datetime.now()
141
+ folder_name = f'date_{now.year}_{now.month}_{now.day}_time_{now.hour}_{now.minute}_{now.second}'
142
  folder_path = synestesia_path + folder_name
143
  if extra_code is not None:
144
  folder_path += '_' + extra_code