echons commited on
Commit
53df8a9
1 Parent(s): 3649333

Updated app

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -59,14 +59,10 @@ if st.button("Generate Music"):
59
  with st.spinner("Generating audio..."):
60
  results = generate_audio(processor, model, prompt)
61
  if results is not None:
62
- with st.spinner("Saving audio..."):
63
- filename = "plant_orchestra" + ".wav"
64
- save_file(model, results, filename)
65
- with st.spinner("Displaying audio..."):
66
- with open(filename, "rb") as f:
67
- generation = f.read()
68
- st.write("Listen to the generated music:")
69
- st.audio(generation)
70
 
71
  # Add additional information and instructions for users
72
  st.sidebar.subheader("How to Use:")
 
59
  with st.spinner("Generating audio..."):
60
  results = generate_audio(processor, model, prompt)
61
  if results is not None:
62
+ sampling_rate = model.config.audio_encoder.sampling_rate
63
+ st.write("Listen to the generated music:")
64
+ st.audio(sample_rate=sampling_rate, data=results[0, 0].cpu().numpy(), format="audio/wav")
65
+
 
 
 
 
66
 
67
  # Add additional information and instructions for users
68
  st.sidebar.subheader("How to Use:")