Spaces:
Running
Running
import gradio as gr | |
import spaces | |
import torch | |
zero = torch.Tensor([0]).cuda() | |
print(zero.device) # <-- 'cpu' π€ | |
def greet(n): | |
print(zero.device) # <-- 'cuda:0' π€ | |
return f"Hello {zero + n} Tensor" | |
def one_shot(image_in,input_text,gender): | |
print("Hello") | |
return "htllo123" | |
def run(): | |
with gr.Blocks(css=".gradio-container {background-color: lightgray} #radio_div {background-color: #FFD8B4; font-size: 40px;}") as demo: | |
gr.Markdown("<h1 style='text-align: center;'>"+ "One Shot Talking Face from Text" + "</h1><br/><br/>") | |
with gr.Group(): | |
# with gr.Box(): | |
with gr.Row(): | |
# with gr.Row().style(equal_height=True): | |
image_in = gr.Image(show_label=True, type="filepath",label="Input Image") | |
input_text = gr.Textbox(show_label=True,label="Input Text") | |
gender = gr.Radio(["Female","Male"],value="Female",label="Gender") | |
video_out = gr.Video(show_label=True,label="Output") | |
with gr.Row(): | |
# with gr.Row().style(equal_height=True): | |
btn = gr.Button("Generate") | |
# gr.Markdown( | |
# """ | |
# <p style='text-align: center;'>Feel free to give us your thoughts on this demo and please contact us at | |
# <a href="mailto:[email protected]" target="_blank">[email protected]</a> | |
# <p style='text-align: center;'>Developed by: <a href="https://www.pragnakalp.com" target="_blank">Pragnakalp Techlabs</a></p> | |
# """) | |
btn.click(one_shot, inputs=[image_in,input_text,gender], outputs=[video_out]) | |
demo.queue() | |
demo.launch(server_name="0.0.0.0", server_port=7860) | |
if __name__ == "__main__": | |
run() | |