Spaces:
Runtime error
Runtime error
import os | |
import gradio as gr | |
from utils import get_text_from_audio, get_video_from_yt | |
from logger import logging | |
import config | |
def get_results(video_url :str) -> str: | |
logging.info(f">>>Getting predictions for : {video_url}") | |
try : | |
video_path = get_video_from_yt(video_url=video_url, save_file_dir=config.AUDIO_FILES_DIR) | |
if not video_path: | |
return "Problem while downloading the video. Please check the logs." | |
text = get_text_from_audio(video_path) | |
if not text: | |
return "Problem generating the text. Please check the logs." | |
return text | |
except Exception as e: | |
logging.exception(e) | |
return str(e) | |
iface = gr.Interface(fn=get_results, inputs="text", outputs="text") | |
iface.launch() | |