Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
USER = os.environ["USER"]
|
4 |
+
PASSWORD = os.environ["PASSWORD"]
|
5 |
+
|
6 |
+
def get_msg(name):
|
7 |
+
return "Hello " + name + "!"
|
8 |
+
|
9 |
+
def verify_auth(username, password):
|
10 |
+
if username == USER and password == PASSWORD:
|
11 |
+
return True
|
12 |
+
else:
|
13 |
+
return False
|
14 |
+
|
15 |
+
|
16 |
+
with gr.Blocks() as demo:
|
17 |
+
|
18 |
+
input = gr.Textbox(label="Prompt", elem_id="textbox")
|
19 |
+
output = gr.Textbox(label="Output", elem_id="textbox")
|
20 |
+
button = gr.Button(value="Make Magic", elem_id="button")
|
21 |
+
button.click(get_msg, inputs=[input], outputs=[output])
|
22 |
+
|
23 |
+
demo.launch(auth=verify_auth)
|