Kvikontent commited on
Commit
d127b43
·
verified ·
1 Parent(s): 7227afb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -23,18 +23,16 @@ def imgquery(payload):
23
  response = requests.post(API_URL_IMG, headers=headers, json=payload)
24
  return response.content
25
 
26
- from IPython.display import Audio
27
-
28
  def generate_audio(prompt):
29
  audio_bytes = query({"inputs": prompt})
30
-
31
- with open("output_audio.wav", "wb") as f:
32
- f.write(audio_bytes)
33
 
34
- display(Audio(data=audio_bytes, autoplay=False))
 
 
35
 
36
- return "output_audio.wav"
37
-
 
38
 
39
  def generate_image(prompt):
40
  image_bytes = imgquery({
 
23
  response = requests.post(API_URL_IMG, headers=headers, json=payload)
24
  return response.content
25
 
 
 
26
  def generate_audio(prompt):
27
  audio_bytes = query({"inputs": prompt})
 
 
 
28
 
29
+ bytes_io = io.BytesIO()
30
+ bytes_io.write(audio_bytes)
31
+ bytes_io.seek(0)
32
 
33
+ display(Audio(data=bytes_io.read(), autoplay=False))
34
+
35
+ return bytes_io
36
 
37
  def generate_image(prompt):
38
  image_bytes = imgquery({