Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def greet(name: str) -> str:
|
| 4 |
+
return f"hello {name}!"
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class App:
|
| 8 |
+
|
| 9 |
+
def __init__(self) -> None:
|
| 10 |
+
self.demo = None
|
| 11 |
+
self.init()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def init(self):
|
| 15 |
+
with gr.Blocks(css="#waring {color: red} .feedback {font-size: 24px}") as self.demo:
|
| 16 |
+
# gr.Markdown(" # \N{glowing start}Gradio教程 ")
|
| 17 |
+
# gr.Markdown(" # \NGradio教程 ")
|
| 18 |
+
gr.Interface(
|
| 19 |
+
fn=greet,
|
| 20 |
+
inputs="text",
|
| 21 |
+
outputs="text"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
self.demo.queue(concurrency_count=20).launch(share=True)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
if __name__ == "__main__":
|
| 30 |
+
app = App()
|