Update app.py
Browse files
app.py
CHANGED
|
@@ -23,6 +23,23 @@ import whisper
|
|
| 23 |
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 24 |
logger = logging.getLogger(__name__)
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
def split_into_sentences(text):
|
| 27 |
blob = TextBlob(text)
|
| 28 |
return [str(sentence) for sentence in blob.sentences]
|
|
@@ -135,6 +152,7 @@ def upload_and_manage(file, platform, language):
|
|
| 135 |
audio_path = "audio.wav"
|
| 136 |
output_video_path = "output_video.mp4"
|
| 137 |
|
|
|
|
| 138 |
# Transcribe audio from uploaded media file and get timestamps
|
| 139 |
transcrption_json = transcribe_video(file.name)
|
| 140 |
|
|
|
|
| 23 |
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 24 |
logger = logging.getLogger(__name__)
|
| 25 |
|
| 26 |
+
def list_available_fonts():
|
| 27 |
+
try:
|
| 28 |
+
# Run the 'fc-list' command to list fonts
|
| 29 |
+
result = subprocess.run(
|
| 30 |
+
["fc-list", "--format", "%{file}\\n"],
|
| 31 |
+
stdout=subprocess.PIPE,
|
| 32 |
+
stderr=subprocess.PIPE,
|
| 33 |
+
text=True,
|
| 34 |
+
check=True
|
| 35 |
+
)
|
| 36 |
+
fonts = result.stdout.splitlines()
|
| 37 |
+
logger.debug(f"Available fonts:\n{fonts}")
|
| 38 |
+
return fonts
|
| 39 |
+
except subprocess.CalledProcessError as e:
|
| 40 |
+
logger.error(f"Error while listing fonts: {e.stderr}")
|
| 41 |
+
return []
|
| 42 |
+
|
| 43 |
def split_into_sentences(text):
|
| 44 |
blob = TextBlob(text)
|
| 45 |
return [str(sentence) for sentence in blob.sentences]
|
|
|
|
| 152 |
audio_path = "audio.wav"
|
| 153 |
output_video_path = "output_video.mp4"
|
| 154 |
|
| 155 |
+
list_available_fonts()
|
| 156 |
# Transcribe audio from uploaded media file and get timestamps
|
| 157 |
transcrption_json = transcribe_video(file.name)
|
| 158 |
|