mgbam commited on
Commit
1a4fd38
ยท
verified ยท
1 Parent(s): aa80548

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -189,6 +189,7 @@ JSON Schema: ```json
189
  """
190
  Asynchronously generates audio by wrapping the synchronous generate_content call.
191
  The call is executed using asyncio.to_thread to avoid blocking.
 
192
  """
193
  task_id = os.path.basename(output_filename).split(".")[0]
194
  logger.info(f"๐ŸŽ™๏ธ [{task_id}] Generating audio for text: '{text[:60]}...'")
@@ -201,8 +202,8 @@ JSON Schema: ```json
201
  contents=prompt,
202
  generation_config=genai.types.GenerationConfig(
203
  response_mime_type="application/octet-stream",
204
- temperature=0.7,
205
- audio_config={"audio_encoding": "LINEAR16", "sample_rate_hertz": AUDIO_SAMPLING_RATE}
206
  )
207
  )
208
  return response
@@ -210,7 +211,7 @@ JSON Schema: ```json
210
  # Execute the synchronous call in a separate thread.
211
  response = await asyncio.to_thread(sync_generate_audio)
212
 
213
- # Process the response. Adjust as necessary based on the APIโ€™s actual response structure.
214
  if not response or not hasattr(response, "audio_chunk") or not response.audio_chunk.data:
215
  logger.error(f"โŒ [{task_id}] No audio data returned.")
216
  st.error(f"Audio generation failed for {task_id}: No audio data.", icon="๐Ÿ”Š")
 
189
  """
190
  Asynchronously generates audio by wrapping the synchronous generate_content call.
191
  The call is executed using asyncio.to_thread to avoid blocking.
192
+ Note: The unsupported 'audio_config' parameter has been removed.
193
  """
194
  task_id = os.path.basename(output_filename).split(".")[0]
195
  logger.info(f"๐ŸŽ™๏ธ [{task_id}] Generating audio for text: '{text[:60]}...'")
 
202
  contents=prompt,
203
  generation_config=genai.types.GenerationConfig(
204
  response_mime_type="application/octet-stream",
205
+ temperature=0.7
206
+ # Removed 'audio_config' to avoid the unexpected keyword argument error.
207
  )
208
  )
209
  return response
 
211
  # Execute the synchronous call in a separate thread.
212
  response = await asyncio.to_thread(sync_generate_audio)
213
 
214
+ # Process the response. Adjust as necessary based on your APIโ€™s actual response structure.
215
  if not response or not hasattr(response, "audio_chunk") or not response.audio_chunk.data:
216
  logger.error(f"โŒ [{task_id}] No audio data returned.")
217
  st.error(f"Audio generation failed for {task_id}: No audio data.", icon="๐Ÿ”Š")