| import gradio as gr | |
| def func(file_obj) -> str: | |
| return file_obj | |
| def auth(username: str, passwd: str) -> bool: | |
| return username == "tom" and passwd == "tom" | |
| def main(): | |
| demo = gr.Interface( | |
| fn=func, | |
| inputs=[gr.Textbox()], | |
| outputs=[gr.Textbox()], | |
| ) | |
| demo.queue(api_open=True) | |
| demo.launch( | |
| auth=auth, | |
| ) | |
| if __name__ == "__main__": | |
| main() |