gradio
gradio copied to clipboard
How to make_ JS parameter references JS file?
I see that the cases provided on the official website are only the cases where the arrow function defines variables and returns. However, how to implement a custom function by referencing an online JS file?
Just i have an online JS file: https://huggingface.co/spaces/changxin/test/raw/main/statics/md5.js How can I use the md5 function?
https://gradio.app/custom_CSS_and_JS/
Hi @tt0203, would you be able to give us more context around this issue? What is your Gradio code, and what does this md5 function do?
@abidlabs
Now,I just try to use the following code:
import gradio as gr demo=gr.Blocks() with demo: with gr.Tabs(): with gr.TabItem("js"): gr.Markdown("# js处理测试") a=gr.Textbox(label='请输入需要js处理的字符串') js_output=gr.Textbox(label="JS输出") js_button=gr.Button("调用js引用") js_button.click(None,a,js_output,_js='(x)=>md5(x);') demo.launch()
I Want to implement the reference of MD5 function in JS file,but it doesn't work.
Hi@abidlabs
Now,I just try to use the following code:
import gradio as gr demo=gr.Blocks() with demo: with gr.Tabs(): with gr.TabItem("js"): gr.Markdown("# js处理测试") a=gr.Textbox(label='请输入需要js处理的字符串') js_output=gr.Textbox(label="JS输出") js_button=gr.Button("调用js引用") js_button.click(None,a,js_output,_js='(x)=>md5(x);')
demo.launch()
I want to implement the reference of MD5 function in JS file,use md5 function to encrypt the gr.Textbox string,but it doesn't work.
Hi @tt0203, as I responded to your other issue, I believe you cannot access external javascript files from inside your Gradio app. This may change in the future (please track #2137), but at this moment we do not support it.