import gradio as gr | |
def get_msg(name, request: gr.Request): | |
if dict(request.headers)['origin'] in os.environ["ORIGIN"]: | |
return "Working" | |
return "Hello " + name + "!" + os.eniron["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() |