abidlabs HF Staff commited on
Commit
e451900
·
verified ·
1 Parent(s): fa76ada

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def func(file_obj) -> str:
4
+ return file_obj.name
5
+
6
+ def auth(username: str, passwd: str) -> bool:
7
+ return username == "tom" and passwd == "123"
8
+
9
+ def main():
10
+ demo = gr.Interface(
11
+ fn=func,
12
+ inputs=[gr.File()],
13
+ outputs=[gr.Textbox()],
14
+ )
15
+ demo.queue(api_open=True)
16
+ demo.launch(
17
+ auth=auth,
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ main()