Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ def audio_video():
|
|
| 50 |
|
| 51 |
return "results/final_output.mp4"
|
| 52 |
|
| 53 |
-
|
| 54 |
def run_inference(input_image, input_audio=None, input_text=None):
|
| 55 |
pil_image = Image.fromarray(input_image.astype(np.uint8))
|
| 56 |
|
|
@@ -125,14 +125,14 @@ def run():
|
|
| 125 |
}
|
| 126 |
"""
|
| 127 |
|
| 128 |
-
with gr.Blocks(
|
| 129 |
-
with gr.
|
| 130 |
gr.Markdown("""
|
| 131 |
# Talkie
|
| 132 |
<div class='subtitle'>Upload an image, add some audio or text, and watch the magic happen! ✨</div>
|
| 133 |
""")
|
| 134 |
-
|
| 135 |
-
|
| 136 |
|
| 137 |
with gr.Row():
|
| 138 |
input_audio = gr.Audio(label="🎵 Your audio (Optional)")
|
|
@@ -140,16 +140,16 @@ def run():
|
|
| 140 |
label="💭 Your text",
|
| 141 |
placeholder="Type your text here..."
|
| 142 |
)
|
|
|
|
|
|
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
video_out = gr.Video(label="🎥 Your video", show_label=True)
|
| 147 |
-
|
| 148 |
-
btn.click(fn=run_inference, inputs=[input_image, input_audio, input_text], outputs=video_out)
|
| 149 |
|
|
|
|
|
|
|
| 150 |
demo.queue()
|
| 151 |
-
|
| 152 |
-
return demo.launch()
|
| 153 |
|
| 154 |
if __name__ == "__main__":
|
| 155 |
run()
|
|
|
|
| 50 |
|
| 51 |
return "results/final_output.mp4"
|
| 52 |
|
| 53 |
+
@spaces.GPU
|
| 54 |
def run_inference(input_image, input_audio=None, input_text=None):
|
| 55 |
pil_image = Image.fromarray(input_image.astype(np.uint8))
|
| 56 |
|
|
|
|
| 125 |
}
|
| 126 |
"""
|
| 127 |
|
| 128 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 129 |
+
with gr.Group():
|
| 130 |
gr.Markdown("""
|
| 131 |
# Talkie
|
| 132 |
<div class='subtitle'>Upload an image, add some audio or text, and watch the magic happen! ✨</div>
|
| 133 |
""")
|
| 134 |
+
with gr.Row():
|
| 135 |
+
input_image = gr.Image(label="📸 Your image")
|
| 136 |
|
| 137 |
with gr.Row():
|
| 138 |
input_audio = gr.Audio(label="🎵 Your audio (Optional)")
|
|
|
|
| 140 |
label="💭 Your text",
|
| 141 |
placeholder="Type your text here..."
|
| 142 |
)
|
| 143 |
+
with gr.Row():
|
| 144 |
+
btn = gr.Button("GENERATE", elem_classes=["generate-btn"])
|
| 145 |
|
| 146 |
+
with gr.Row():
|
| 147 |
+
video_out = gr.Video(label="🎥 Your video", show_label=True)
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
+
|
| 150 |
+
btn.click(fn=run_inference, inputs=[input_image, input_audio, input_text], outputs=video_out)
|
| 151 |
demo.queue()
|
| 152 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 153 |
|
| 154 |
if __name__ == "__main__":
|
| 155 |
run()
|