Hasan Iqbal
		
	commited on
		
		
					Set theme to light mode permenantly
Browse files- src/openfactcheck/app/app.py +14 -3
    	
        src/openfactcheck/app/app.py
    CHANGED
    
    | @@ -12,14 +12,25 @@ def greet(name): | |
| 12 | 
             
                """
         | 
| 13 | 
             
                return f"Hello, {name}! Welcome to Gradio."
         | 
| 14 |  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 17 | 
             
                fn=greet,  # Function to call
         | 
| 18 | 
             
                inputs=gr.Textbox(placeholder="Enter your name here...", label="Name"),  # Input component
         | 
| 19 | 
             
                outputs="text",  # Output component type
         | 
| 20 | 
             
                title="Hello World App",  # Title of the app
         | 
| 21 | 
             
                description="A simple Gradio app that greets you."  # Description of the app
         | 
| 22 | 
            -
            )
         | 
| 23 |  | 
| 24 | 
             
            # Run the interface
         | 
| 25 | 
             
            if __name__ == "__main__":
         | 
|  | |
| 12 | 
             
                """
         | 
| 13 | 
             
                return f"Hello, {name}! Welcome to Gradio."
         | 
| 14 |  | 
| 15 | 
            +
            js_func = """
         | 
| 16 | 
            +
            function refresh() {
         | 
| 17 | 
            +
                const url = new URL(window.location);
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                if (url.searchParams.get('__theme') !== 'light') {
         | 
| 20 | 
            +
                    url.searchParams.set('__theme', 'light');
         | 
| 21 | 
            +
                    window.location.href = url.href;
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
            }
         | 
| 24 | 
            +
            """
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            with gr.Blocks(js=js_func) as demo:
         | 
| 27 | 
            +
                gr.Interface(
         | 
| 28 | 
             
                fn=greet,  # Function to call
         | 
| 29 | 
             
                inputs=gr.Textbox(placeholder="Enter your name here...", label="Name"),  # Input component
         | 
| 30 | 
             
                outputs="text",  # Output component type
         | 
| 31 | 
             
                title="Hello World App",  # Title of the app
         | 
| 32 | 
             
                description="A simple Gradio app that greets you."  # Description of the app
         | 
| 33 | 
            +
                )
         | 
| 34 |  | 
| 35 | 
             
            # Run the interface
         | 
| 36 | 
             
            if __name__ == "__main__":
         |