Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import spaces
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
@spaces.GPU(duration=10)
|
| 8 |
+
def fn():
|
| 9 |
+
time.sleep(5)
|
| 10 |
+
return "a"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
btn = gr.Button()
|
| 15 |
+
out = gr.Textbox()
|
| 16 |
+
btn.click(fn=fn, outputs=out)
|
| 17 |
+
demo.launch()
|