File size: 572 Bytes
9649d56
29a7e40
9649d56
 
 
 
 
5ce0be8
9649d56
a501439
 
 
bbaf0d1
 
29a7e40
 
c7964dd
 
b9dcd0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
import os

def echo(name, request: gr.Request):
    if request:
        print("Request headers dictionary:", request.headers)
        print("IP address:", request.client.host)
    return str(request.headers), str(request.client.host)

def verify_auth(username, password):
    # if dict(request.headers)['origin'] in os.environ["ORIGIN"]:
    #     return True 
    elif username=="admin" and password=="admin":
        return True 
    else:
        return False
    

io = gr.Interface(echo, "textbox", ["textbox", "textbox"]).launch(auth=verify_auth)