Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,38 +56,11 @@ print("2:", os.path.join(os.path.dirname(__file__), "example/test.mp4") )
|
|
| 56 |
# )
|
| 57 |
|
| 58 |
#demo.queue().launch(debug=True)
|
|
|
|
| 59 |
def my_function(x, progress=gr.Progress()):
|
| 60 |
progress(0, desc="Starting...")
|
| 61 |
time.sleep(1)
|
| 62 |
for i in progress.tqdm(range(100)):
|
| 63 |
time.sleep(0.1)
|
| 64 |
return x
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
def combine(a, b, progress=gr.Progress()):
|
| 68 |
-
progress(0, desc="Starting...")
|
| 69 |
-
time.sleep(1)
|
| 70 |
-
for i in progress.tqdm(range(100)):
|
| 71 |
-
time.sleep(0.1)
|
| 72 |
-
return a + " " + b
|
| 73 |
-
|
| 74 |
-
with gr.Blocks() as demo:
|
| 75 |
-
|
| 76 |
-
txt = gr.Textbox(label="Input", lines=2)
|
| 77 |
-
txt_2 = gr.Textbox(label="Input 2")
|
| 78 |
-
txt_3 = gr.Textbox(value="", label="Output")
|
| 79 |
-
btn = gr.Button(value="Submit")
|
| 80 |
-
|
| 81 |
-
btn.click(combine, inputs=[txt,txt_2], outputs=[txt_3])
|
| 82 |
-
|
| 83 |
-
gr.Markdown("## Text Examples")
|
| 84 |
-
gr.Examples(
|
| 85 |
-
[["hi", "h"], ["hello", "hell"]],
|
| 86 |
-
[txt, txt_2],
|
| 87 |
-
txt_3,
|
| 88 |
-
combine,
|
| 89 |
-
cache_examples=True,
|
| 90 |
-
)
|
| 91 |
-
|
| 92 |
-
if __name__ == "__main__":
|
| 93 |
-
demo.queue().launch()
|
|
|
|
| 56 |
# )
|
| 57 |
|
| 58 |
#demo.queue().launch(debug=True)
|
| 59 |
+
|
| 60 |
def my_function(x, progress=gr.Progress()):
|
| 61 |
progress(0, desc="Starting...")
|
| 62 |
time.sleep(1)
|
| 63 |
for i in progress.tqdm(range(100)):
|
| 64 |
time.sleep(0.1)
|
| 65 |
return x
|
| 66 |
+
gr.Interface(my_function, gr.Textbox(), gr.Textbox()).queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|