File size: 561 Bytes
9649d56 baa86c3 1b3c40f 126eb71 89008c3 126eb71 e0e4e6d 9649d56 126eb71 9649d56 126eb71 c7964dd 126eb71 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
import os
def get_msg(name, request: gr.Request):
trueorigin = str(os.environ["ORIGIN"])
actualorigin = dict(request.headers)['origin']
if actualorigin == trueorigin:
return "Working"
return "Hello " + name + "!" + os.environ["ORIGIN"]
with gr.Blocks() as demo:
input = gr.Textbox(label="Prompt", elem_id="textbox")
output = gr.Textbox(label="Output", elem_id="textbox")
button = gr.Button(value="Make Magic", elem_id="button")
button.click(get_msg, inputs=[input], outputs=[output])
demo.launch() |