yash184 commited on
Commit
4ea5aa2
·
verified ·
1 Parent(s): 18af50a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -9,7 +9,7 @@ from typing import Optional
9
 
10
  torch.set_num_threads(int(os.environ.get("TORCH_THREADS", "2")))
11
 
12
- SECRET = os.environ.get("TTS_SECRET_KEY", "") # Space Settings -> Secrets me daalo
13
  DEFAULT_VOICE = os.environ.get("VOICE", "hf_alpha") # hf_alpha, hf_beta (female) | hm_omega, hm_psi (male)
14
  ALLOWED_VOICES = {"hf_alpha", "hf_beta", "hm_omega", "hm_psi"}
15
  DEFAULT_SPEED = float(os.environ.get("SPEED", "1.0"))
@@ -53,7 +53,7 @@ app.add_middleware(
53
 
54
  def authorized(request: Request) -> bool:
55
  if not SECRET:
56
- return False
57
  cands = [
58
  request.headers.get("x-secret-key", ""),
59
  request.query_params.get("key", ""),
@@ -65,7 +65,7 @@ def authorized(request: Request) -> bool:
65
 
66
 
67
  def split_clean(text: str):
68
- """Text saaf karo, vakyon me todo, phir ~200 chars ke tukdon me jodo (Kokoro ko medium length pasand he)."""
69
  text = re.sub(r"[\*#_`~>\[\]\{\}\(\)<>|\\/]", " ", text)
70
  text = text.replace("\u0964", ".").replace("\u0965", ".").replace("\r", "\n")
71
  pieces = re.split(r"(?<=[\.\?\!])\s+|\n+", text)
 
9
 
10
  torch.set_num_threads(int(os.environ.get("TORCH_THREADS", "2")))
11
 
12
+ SECRET = os.environ.get("TTS_SECRET_KEY", "") # khali he to koi key nahi lagegi
13
  DEFAULT_VOICE = os.environ.get("VOICE", "hf_alpha") # hf_alpha, hf_beta (female) | hm_omega, hm_psi (male)
14
  ALLOWED_VOICES = {"hf_alpha", "hf_beta", "hm_omega", "hm_psi"}
15
  DEFAULT_SPEED = float(os.environ.get("SPEED", "1.0"))
 
53
 
54
  def authorized(request: Request) -> bool:
55
  if not SECRET:
56
+ return True # koi secret set nahi he -> sab ko allow
57
  cands = [
58
  request.headers.get("x-secret-key", ""),
59
  request.query_params.get("key", ""),
 
65
 
66
 
67
  def split_clean(text: str):
68
+ """Text saaf karo, vakyon me todo, phir ~200 chars ke tukdon me jodo."""
69
  text = re.sub(r"[\*#_`~>\[\]\{\}\(\)<>|\\/]", " ", text)
70
  text = text.replace("\u0964", ".").replace("\u0965", ".").replace("\r", "\n")
71
  pieces = re.split(r"(?<=[\.\?\!])\s+|\n+", text)