jspr commited on
Commit
5587862
1 Parent(s): 2295872

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -24,6 +24,13 @@ def get_note_text(prompt):
24
  stop=["###"]
25
  )
26
  return response.choices[0].text.strip()
 
 
 
 
 
 
 
27
 
28
  def get_drummer_output(prompt, tempo):
29
  openai.api_key = os.environ['key']
@@ -37,6 +44,7 @@ def get_drummer_output(prompt, tempo):
37
  # bpm = int(reg.predict(prompt_enc)[0]) + 20
38
  audio = text_to_audio(note_text, tempo)
39
  audio = np.array(audio.get_array_of_samples(), dtype=np.float32)
 
40
  return (96000, audio)
41
 
42
  iface = gr.Interface(
 
24
  stop=["###"]
25
  )
26
  return response.choices[0].text.strip()
27
+
28
+ def increment_count():
29
+ with open('count.txt', 'r') as f:
30
+ count = int(f.read())
31
+ count += 1
32
+ with open('count.txt', 'w') as f:
33
+ f.write(str(count))
34
 
35
  def get_drummer_output(prompt, tempo):
36
  openai.api_key = os.environ['key']
 
44
  # bpm = int(reg.predict(prompt_enc)[0]) + 20
45
  audio = text_to_audio(note_text, tempo)
46
  audio = np.array(audio.get_array_of_samples(), dtype=np.float32)
47
+ increment_count()
48
  return (96000, audio)
49
 
50
  iface = gr.Interface(