ASG Models commited on
Commit
a740b3f
·
verified ·
1 Parent(s): 070483f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -8,7 +8,17 @@ from genai_chat_ai import AI,create_chat_session
8
  api_key = os.environ.get("Id_mode_vits")
9
  headers = {"Authorization": f"Bearer {api_key}"}
10
 
 
 
 
11
 
 
 
 
 
 
 
 
12
 
13
  def query(text,API_URL):
14
  payload={"inputs": text}
@@ -43,6 +53,7 @@ def reverse_audio(text,model_choice):
43
  API_URL = f"https://api-inference.huggingface.co/models/{model_choice}"
44
  text_answer=get_answer_ai(text)
45
  dataq = query(text,API_URL)
 
46
  dataa = query(text_answer,API_URL)
47
 
48
  # data_enhanc = remove_noise_enhance(data)
 
8
  api_key = os.environ.get("Id_mode_vits")
9
  headers = {"Authorization": f"Bearer {api_key}"}
10
 
11
+ def remove_extra_spaces(text):
12
+ """
13
+ Removes extra spaces between words in a string.
14
 
15
+ Args:
16
+ text: The string to process.
17
+
18
+ Returns:
19
+ The string with extra spaces removed.
20
+ """
21
+ return ' '.join(text.split())
22
 
23
  def query(text,API_URL):
24
  payload={"inputs": text}
 
53
  API_URL = f"https://api-inference.huggingface.co/models/{model_choice}"
54
  text_answer=get_answer_ai(text)
55
  dataq = query(text,API_URL)
56
+ text_answer=remove_extra_spaces(text_answer)
57
  dataa = query(text_answer,API_URL)
58
 
59
  # data_enhanc = remove_noise_enhance(data)