import os
import gradio as gr

#os.environ["HF_TOKEN"] = os.getenv('demo_gradioapp')

js_dark_theme = """
function refresh() {
    const url = new URL(window.location);
    if (url.searchParams.get('__theme') !== 'dark') {
        url.searchParams.set('__theme', 'dark');
        window.location.href = url.href;
    }
}
"""

# For ithentication issue, always share https://pctseng-demo.hf.space

demo = gr.load("PCTseng/EFP_Demo", src="spaces", hf_token = os.getenv('demo_gradioapp'), js=js_dark_theme).render()
demo.queue().launch(auth=('demo',os.getenv('password')), share=True, ssr_mode=False, show_api=False)