Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
user_db={"用户名":"畅心","密码":"123456"}
|
3 |
+
def fx(x:str):
|
4 |
+
return '欢迎浏览:'+x
|
5 |
+
demo = gr.Blocks()
|
6 |
+
with demo:
|
7 |
+
gr.Dataframe(headers=['项目','数据'],interactive=True)
|
8 |
+
text_input=gr.Textbox(placeholder='请输入测试字符串',label="请输入测试内容")
|
9 |
+
bt=gr.Button("运行")
|
10 |
+
bt.click(fx, inputs=text_input, outputs=gr.Textbox(label="输出"))
|
11 |
+
|
12 |
+
demo.launch(enable_queue=True,auth=lambda a,b:user_db.get(a)==b,auth_message="欢迎使用本web app")
|
13 |
+
|