import gradio as gr import os import shlex import random LINK = os.environ.get('link') ALIAS = os.environ.get('alias') TITLE = os.environ.get('title') DESCRIPTION = os.environ.get('description') os.system(f"megadl {LINK}") os.system("ls") def inference(text): os.system("python demo_cli.py --no_sound --cpu --text " + shlex.quote(text.strip())) image_number = random.randint(2, len(os.listdir(f"images/{ALIAS}/"))) return [f"images/{ALIAS}/{image_number}.gif", "demo_output_1.wav"] article = "
Based on Real-Time Voice Cloning | Github Repo
" examples = [ [ "Star Wars: Episode One - The Phantom Menace - is the most disappointing thing since my son" ], [ "My name is Samantha Morris. I'm the editor of an internet news magazine exploring news most media shy away from." ], [ 'I have a morning ritual that I need to share. I call it - the terminator. First I crouch down in the shower in the classic naked terminator traveling through time pose.' ], [ 'With my eyes closed I crouch there for a minute, visualizing either Arnold or the guy from the second movie (not the chick in the third one because that one sucked) and I start to hum the terminator theme.' ], [ 'Then I slowly rise to a standing position and open my eyes. It helps me to proceed through my day as an emotionless, cyborg badass. The only problem is if the shower curtain sticks to my terminator leg. It ruins the fantasy.' ], [ "Okay, hear me out. So it's about this guy named Rick. He's a scientist that turns himself into a pickle. Funniest thing I've seen. In the episode Rick's grandson, Morty flips over a talking pickle. And its Rick! It's the funniest thing." ], [ "To be fair, you have to have a very high IQ to understand Rick and Morty. The humour is extremely subtle, and without a solid grasp of theoretical physics most of the jokes will go over a typical viewer's head. There's also Rick's nihilistic outlook, which is deftly woven into his characterisation. " ], ] gr.Interface( inference, inputs=["text"], outputs=[ gr.Image(show_label=False, shape=(20, 20), value=f"images/{ALIAS}/1.gif"), gr.outputs.Audio(type="file", label="Speech"), ], enable_queue=True, title=TITLE, description=DESCRIPTION, article=article, examples=examples ).launch()