Spaces:
Runtime error
Runtime error
Commit ·
6debebc
1
Parent(s): fb39f96
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
def identity_with_sleep(x):
|
| 5 |
+
time.sleep(0.5)
|
| 6 |
+
return x
|
| 7 |
+
|
| 8 |
+
with gr.Blocks() as demo:
|
| 9 |
+
with gr.Row():
|
| 10 |
+
with gr.Column():
|
| 11 |
+
input_img = gr.Image()
|
| 12 |
+
output_img = gr.Image()
|
| 13 |
+
submit_img = gr.Button()
|
| 14 |
+
submit_img.click(identity_with_sleep, input_img, output_img, api_name="img")
|
| 15 |
+
with gr.Column():
|
| 16 |
+
input_txt = gr.Text()
|
| 17 |
+
output_text = gr.Text()
|
| 18 |
+
submit_text = gr.Button()
|
| 19 |
+
submit_text.click(identity_with_sleep, input_txt, output_text, api_name="text")
|
| 20 |
+
with gr.Column():
|
| 21 |
+
input_audio = gr.Audio()
|
| 22 |
+
output_audio = gr.Audio()
|
| 23 |
+
submit_audio = gr.Button()
|
| 24 |
+
submit_audio.click(identity_with_sleep, input_audio, output_audio, api_name="audio")
|
| 25 |
+
with gr.Column():
|
| 26 |
+
input_video = gr.Video()
|
| 27 |
+
output_video = gr.Video()
|
| 28 |
+
submit_video = gr.Button()
|
| 29 |
+
submit_video.click(identity_with_sleep, input_video, output_video, api_name="video")
|
| 30 |
+
demo.queue(max_size=50, concurrency_count=20).launch()
|