Spaces:
Runtime error
Runtime error
New Avatar's First Commit
Browse files
app.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def avatar_pro(videos, powerpoint):
|
| 6 |
+
return videos
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def avatar_lite(image, text, powerpoint):
|
| 10 |
+
return 0
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
|
| 15 |
+
gr.Markdown('''## Avatar: Easily Show Yourself
|
| 16 |
+
Please Chose User Model: **Avatar Pro** or **Avatar Lite**
|
| 17 |
+
In Avatar Program, You can easily generate a video with your own cartoon image for powerpoint presentation
|
| 18 |
+
In **Avatar Pro** mode, You need to upload a video and a powerpoint file
|
| 19 |
+
In **Avatar Lite** mode, You need to upload a selfie, a powerpoint and a presentation text''')
|
| 20 |
+
|
| 21 |
+
with gr.Tab("Avatar Pro"):
|
| 22 |
+
with gr.Row():
|
| 23 |
+
video_input_pro = gr.Video(label="Please Upload Your Representation Video")
|
| 24 |
+
ppt_input_pro = gr.File(label="Please Upload your Powerpoint File")
|
| 25 |
+
video_output_pro = gr.Video(label="Here is your final Video")
|
| 26 |
+
pro_button = gr.Button("Generate!")
|
| 27 |
+
with gr.Tab("Avatar Lite"):
|
| 28 |
+
text_input_lite = gr.Textbox(label="Please Enter Your Speech")
|
| 29 |
+
with gr.Row():
|
| 30 |
+
image_input_lite = gr.Image(label="Please Upload Your Photo")
|
| 31 |
+
ppt_input_lite = gr.File(label="Please Upload your Powerpoint File")
|
| 32 |
+
video_output_lite = gr.Video(label="Here is your final Video")
|
| 33 |
+
lite_button = gr.Button("Generate!")
|
| 34 |
+
|
| 35 |
+
inputs_pro = [video_input_pro, ppt_input_pro]
|
| 36 |
+
inputs_lite = [image_input_lite, text_input_lite, ppt_input_lite]
|
| 37 |
+
|
| 38 |
+
pro_button.click(avatar_pro, inputs=inputs_pro, outputs=video_output_pro)
|
| 39 |
+
lite_button.click(avatar_lite, inputs=inputs_lite, outputs=video_output_lite)
|
| 40 |
+
|
| 41 |
+
demo.launch()
|