File size: 678 Bytes
c27a644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This is a simple Gradio app that greets the user and is protected by username and password.
import gradio as gr

# Define a function that takes a name and returns a greeting.
def greet(name):
    return "Hello " + name + "!"

# Create a Gradio interface that takes a textbox input, runs it through the greet function, and returns output to a textbox.
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")

# Define the username and password for authentication.
def auth(username, password):
    return username == "user" and password == "pass"

# Launch the interface on Hugging Face Spaces with authentication.
demo.launch(share=True, auth=auth, show_error=True)