Skip to content

Commit 16a39ea

Browse files
committed
Fixups
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 88aea3d commit 16a39ea

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ docker-build-kitten-tts:
429429
docker-save-kitten-tts: backend-images
430430
docker save local-ai-backend:kitten-tts -o backend-images/kitten-tts.tar
431431

432+
docker-save-chatterbox: backend-images
433+
docker save local-ai-backend:chatterbox -o backend-images/chatterbox.tar
434+
432435
docker-build-kokoro:
433436
docker build --build-arg BUILD_TYPE=$(BUILD_TYPE) --build-arg BASE_IMAGE=$(BASE_IMAGE) -t local-ai-backend:kokoro -f backend/Dockerfile.python --build-arg BACKEND=kokoro ./backend
434437

backend/python/chatterbox/backend.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@
1818
import grpc
1919

2020
def is_float(s):
21+
"""Check if a string can be converted to float."""
2122
try:
2223
float(s)
2324
return True
2425
except ValueError:
2526
return False
27+
def is_int(s):
28+
"""Check if a string can be converted to int."""
29+
try:
30+
int(s)
31+
return True
32+
except ValueError:
33+
return False
2634

2735
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
2836

@@ -68,10 +76,11 @@ def LoadModel(self, request, context):
6876
key, value = opt.split(":")
6977
# if value is a number, convert it to the appropriate type
7078
if is_float(value):
71-
if value.is_integer():
72-
value = int(value)
73-
else:
74-
value = float(value)
79+
value = float(value)
80+
elif is_int(value):
81+
value = int(value)
82+
elif value.lower() in ["true", "false"]:
83+
value = value.lower() == "true"
7584
self.options[key] = value
7685

7786
self.AudioPath = None

0 commit comments

Comments
 (0)