Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
def echo(name, request: gr.Request):
|
4 |
if request:
|
@@ -7,7 +8,10 @@ def echo(name, request: gr.Request):
|
|
7 |
return str(request.headers), str(request.client.host)
|
8 |
|
9 |
def verify_auth(username, password, request: gr.Request):
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
io = gr.Interface(echo, "textbox", ["textbox", "textbox"]).launch(auth=verify_auth)
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
|
4 |
def echo(name, request: gr.Request):
|
5 |
if request:
|
|
|
8 |
return str(request.headers), str(request.client.host)
|
9 |
|
10 |
def verify_auth(username, password, request: gr.Request):
|
11 |
+
if dict(request.headers)['origin'] == os.environ["ORIGIN"]
|
12 |
+
return True
|
13 |
+
else:
|
14 |
+
return False
|
15 |
|
16 |
|
17 |
io = gr.Interface(echo, "textbox", ["textbox", "textbox"]).launch(auth=verify_auth)
|