demo 1
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import spaces
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
@spaces.GPU
|
6 |
+
def gpu():
|
7 |
+
return "Invoking gpu";
|
8 |
+
|
9 |
+
def nogpu():
|
10 |
+
return "No Gpu";
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
with gr.Blocks():
|
15 |
+
outgpu = gr.Textbox(lines=5);
|
16 |
+
outnpu = gr.Textbox(lines=5);
|
17 |
+
btn = gr.Button(fn=gpu, label="gpu",[outgpu]);
|
18 |
+
btn = gr.Button(fn=ngpu, label="ngpu", [outnpu]);
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch(
|
23 |
+
share=False,
|
24 |
+
debug=False,
|
25 |
+
server_port=7860,
|
26 |
+
server_name="0.0.0.0",
|
27 |
+
allowed_paths=[ZIP_DIR]
|
28 |
+
)
|