Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import json | |
| def predict(text, url_params): | |
| print(url_params) | |
| #json_string = json.loads(url_params) | |
| if url_params.get('123') =='456': | |
| out = gr.HTML.update("""Success""") | |
| else: | |
| out=gr.HTML.update("""<head><meta http-equiv="refresh" content="1;URL='https://omnibus-redirect-access.hf.space'"></head>""") | |
| return ["Hello " + text + "!!", url_params,out] | |
| get_window_url_params = """ | |
| function(text_input, url_params) { | |
| console.log(text_input, url_params); | |
| const params = new URLSearchParams(window.location.search); | |
| url_params = Object.fromEntries(params); | |
| return [text_input, url_params]; | |
| } | |
| """ | |
| with gr.Blocks() as app: | |
| markdown = gr.HTML("""Authorization Failed""") | |
| with gr.Row(visible=False): | |
| text_input=gr.Textbox() | |
| text_output=gr.Textbox() | |
| url_params = gr.JSON({}, visible=True, label="") | |
| #app.load(fn=predict, inputs=[text_input,url_params],outputs=[text_output,url_params,markdown], _js=get_window_url_params) | |
| app.launch() |