Update handler.py
Browse files- handler.py +11 -1
handler.py
CHANGED
@@ -15,10 +15,20 @@ class EndpointHandler:
|
|
15 |
|
16 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
17 |
try:
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
return self.process_hf_input(data)
|
20 |
else:
|
21 |
return self.process_json_input(data)
|
|
|
22 |
except ValueError as e:
|
23 |
return {"error": str(e)}
|
24 |
except Exception as e:
|
|
|
15 |
|
16 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
17 |
try:
|
18 |
+
# Clone the repository
|
19 |
+
repo_url = "https://huggingface.co/mazalaai/TTS_Mongolian.git"
|
20 |
+
os.system(f"git clone {repo_url}")
|
21 |
+
|
22 |
+
# Change directory to the cloned repository
|
23 |
+
repo_dir = "TTS_Mongolian"
|
24 |
+
os.chdir(repo_dir)
|
25 |
+
|
26 |
+
if "inputs" in data:
|
27 |
+
# Check if data is in Hugging Face JSON format
|
28 |
return self.process_hf_input(data)
|
29 |
else:
|
30 |
return self.process_json_input(data)
|
31 |
+
|
32 |
except ValueError as e:
|
33 |
return {"error": str(e)}
|
34 |
except Exception as e:
|