Spaces:
Sleeping
Sleeping
Update steganography.py
Browse files- steganography.py +14 -4
steganography.py
CHANGED
@@ -7,12 +7,22 @@ import gradio as gr
|
|
7 |
import soundfile as sf
|
8 |
import os
|
9 |
import gettext
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
locales_dir = 'locales'
|
13 |
-
|
14 |
-
lang.
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# Function for creating a spectrogram image with text
|
18 |
def text_to_spectrogram_image(text, base_width=512, height=256, max_font_size=80, margin=10, letter_spacing=5):
|
|
|
7 |
import soundfile as sf
|
8 |
import os
|
9 |
import gettext
|
10 |
+
import os
|
11 |
+
|
12 |
+
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
|
13 |
+
if not os.path.exists(font_path):
|
14 |
+
font_path = "/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf" # Fallback font
|
15 |
|
16 |
+
# Handle missing translation files
|
17 |
locales_dir = 'locales'
|
18 |
+
try:
|
19 |
+
lang = gettext.translation('base', localedir=locales_dir, languages=['en'])
|
20 |
+
lang.install()
|
21 |
+
_ = lang.gettext
|
22 |
+
except FileNotFoundError:
|
23 |
+
print("Translation file not found, using default language.")
|
24 |
+
_ = lambda s: s # Fallback to the original string if translation is unavailable
|
25 |
+
|
26 |
|
27 |
# Function for creating a spectrogram image with text
|
28 |
def text_to_spectrogram_image(text, base_width=512, height=256, max_font_size=80, margin=10, letter_spacing=5):
|