seawolf2357 commited on
Commit
02665d5
Β·
1 Parent(s): f3d41cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -28,9 +28,15 @@ def generate_audio(text, voice_name):
28
  response = requests.post(url, json=payload, headers=headers, stream=True)
29
 
30
  if response.status_code == 200:
31
- return response.content
 
 
 
 
32
  else:
33
  raise Exception(f"였λ₯˜ λ°œμƒ. μƒνƒœ μ½”λ“œ: {response.status_code}")
 
 
34
 
35
  # Gradio μΈν„°νŽ˜μ΄μŠ€ μ •μ˜
36
  with gr.Blocks() as demo:
 
28
  response = requests.post(url, json=payload, headers=headers, stream=True)
29
 
30
  if response.status_code == 200:
31
+
32
+ chunks = []
33
+ for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
34
+ chunks.append(chunk)
35
+ return b''.join(chunks)
36
  else:
37
  raise Exception(f"였λ₯˜ λ°œμƒ. μƒνƒœ μ½”λ“œ: {response.status_code}")
38
+ CHUNK_SIZE = 300
39
+
40
 
41
  # Gradio μΈν„°νŽ˜μ΄μŠ€ μ •μ˜
42
  with gr.Blocks() as demo: