Sahana31 commited on
Commit
cacc326
·
1 Parent(s): e0aff3f

updated with api key

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import gradio as gr
3
  import requests
4
  import logging
@@ -21,19 +20,23 @@ def get_audio(input_text, usecase_id):
21
  return f"Error: Use case with ID {usecase_id} not found."
22
 
23
  voice_description = usecase["voice_description"]
24
- print(voice_description)
25
- print(input_text)
 
26
  # Define the API endpoint and headers
27
- url = "https://gaganyatri-indic-all-server.hf.space/v1/audio/speech"
28
  headers = {
29
- "accept": "application/json",
30
  "Content-Type": "application/json"
31
  }
32
 
33
  # Define the request payload
34
  payload = {
35
  "input": input_text,
36
- "voice": voice_description
 
 
 
37
  }
38
 
39
  # Send the POST request
 
 
1
  import gradio as gr
2
  import requests
3
  import logging
 
20
  return f"Error: Use case with ID {usecase_id} not found."
21
 
22
  voice_description = usecase["voice_description"]
23
+ logger.info(f"Voice Description: {voice_description}")
24
+ logger.info(f"Input Text: {input_text}")
25
+
26
  # Define the API endpoint and headers
27
+ url = "https://gaganyatri-llm-indic-server-cpu.hf.space/v1/audio/speech"
28
  headers = {
29
+ "X-API-Key": "your-new-secret-api-key",
30
  "Content-Type": "application/json"
31
  }
32
 
33
  # Define the request payload
34
  payload = {
35
  "input": input_text,
36
+ "voice": voice_description,
37
+ "model": "ai4bharat/indic-parler-tts",
38
+ "response_format": "mp3",
39
+ "speed": 1.0
40
  }
41
 
42
  # Send the POST request