sachin commited on
Commit
e592dcc
·
1 Parent(s): 6c1f7df
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -15,7 +15,21 @@ def get_lang_name(lang_string):
15
  return lang_string.split("(")[0].strip().lower()
16
 
17
  def transcribe_api(audio_file, language):
18
- url = f"https://slabstech-dhwani-server-workshop.hf.space/v1/transcribe/?language={get_lang_name(language)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  headers = {
21
  "accept": "application/json",
 
15
  return lang_string.split("(")[0].strip().lower()
16
 
17
  def transcribe_api(audio_file, language):
18
+
19
+ import os
20
+
21
+ # Get the base URL (IP or domain) from environment variable
22
+ base_url = os.getenv("DWANI_AI_API_BASE_URL")
23
+
24
+ if not base_url:
25
+ raise ValueError("DWANI_AI_API_BASE_URL environment variable is not set")
26
+
27
+ # Define the endpoint path
28
+ endpoint = "v1/transcribe/?language"
29
+
30
+ # Construct the full API URL
31
+ url = f"{base_url.rstrip('/')}{endpoint}"
32
+ url = f"{url}={get_lang_name(language)}"
33
 
34
  headers = {
35
  "accept": "application/json",