Spaces:
Runtime error
Runtime error
from gradio_client import Client | |
import gradio as gr | |
def interact_with_api(video_url, target_language, translate_video): | |
client = Client("https://artificialguybr-video-translation-transcription.hf.space/") | |
result = client.predict( | |
video_url, | |
target_language, | |
translate_video, | |
api_name="/predict" | |
) | |
return result | |
# Lista de opções de idiomas | |
language_options = [ | |
"Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani", "Basque", "Belarusian", | |
"Bengali", "Bosnian", "Bulgarian", "Catalan", "Cebuano", "Chichewa", "Chinese (Simplified)", | |
"Chinese (Traditional)", "Corsican", "Croatian", "Czech", "Danish", "Dutch", "English", "Esperanto", | |
"Estonian", "Filipino", "Finnish", "French", "Frisian", "Galician", "Georgian", "German", "Greek", | |
"Gujarati", "Haitian Creole", "Hausa", "Hawaiian", "Hebrew", "Hindi", "Hmong", "Hungarian", "Icelandic", | |
"Igbo", "Indonesian", "Irish", "Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", | |
"Korean", "Kurdish (Kurmanji)", "Kyrgyz", "Lao", "Latin", "Latvian", "Lithuanian", "Luxembourgish", | |
"Macedonian", "Malagasy", "Malay", "Malayalam", "Maltese", "Maori", "Marathi", "Mongolian", | |
"Myanmar (Burmese)", "Nepali", "Norwegian", "Odia", "Pashto", "Persian", "Polish", "Portuguese", | |
"Punjabi", "Romanian", "Russian", "Samoan", "Scots Gaelic", "Serbian", "Sesotho", "Shona", "Sindhi", | |
"Sinhala", "Slovak", "Slovenian", "Somali", "Spanish", "Sundanese", "Swahili", "Swedish", "Tajik", | |
"Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu", "Uyghur", "Uzbek", "Vietnamese", "Welsh", | |
"Xhosa", "Yiddish", "Yoruba", "Zulu" | |
] | |
iface = gr.Interface( | |
fn=interact_with_api, | |
inputs=[ | |
gr.Video(label="Upload Video or Enter URL"), | |
gr.Dropdown(choices=language_options, label="Target Language for Translation", value="English"), | |
gr.Checkbox(label="Translate Video", value=True, info="Check to translate the video to the selected language. Uncheck for transcription only."), | |
], | |
outputs="video", | |
title="VIDEO TRANSCRIPTION AND TRANSLATION", | |
description="""This tool was developed by [@artificialguybr](https://twitter.com/artificialguybr) using entirely open-source tools. Special thanks to Hugging Face for the GPU support. Test the [Video Dubbing](https://huggingface.co/spaces/artificialguybr/video-dubbing) space!""", | |
allow_flagging=False | |
) | |
with gr.Blocks() as demo: | |
iface.render() | |
gr.Markdown(""" | |
**Note:** | |
- Video limit is 15 minutes. It will do the transcription and translate of subtitles. | |
- The tool uses open-source models for all models. It's an alpha version. | |
""") | |
demo.queue | |
demo.launch() | |