Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| load_js = """ | |
| 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] | |
| } | |
| """ | |
| def predict(text, url_params): | |
| mod_url="" | |
| mod=gr.HTML("") | |
| out = None | |
| valid=gr.update(visible=False) | |
| mod_url = url_params.get('url') | |
| print (mod_url) | |
| return ["" + text + "", mod_url] | |
| with gr.Blocks() as app: | |
| 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,text_input],_js=load_js) | |