Marcelo Lotif
		
	commited on
		
		
					Commit 
							
							·
						
						853a51e
	
1
								Parent(s):
							
							66f1c0c
								
White logo and media query for dark theme
Browse files- app.py +6 -2
- src/assets/{logo-icon.png → logo-icon-black.png} +0 -0
- src/assets/logo-icon-white.png +0 -0
- src/display/css_html_js.py +19 -1
    	
        app.py
    CHANGED
    
    | @@ -72,13 +72,16 @@ def init_leaderboard(dataframe, benchmark_type): | |
| 72 | 
             
                    wrap=False,
         | 
| 73 | 
             
                )
         | 
| 74 |  | 
|  | |
|  | |
| 75 |  | 
| 76 | 
             
            demo = gr.Blocks(css=custom_css, theme=gr.themes.Default(primary_hue=gr.themes.colors.pink))
         | 
| 77 | 
             
            with demo:
         | 
| 78 | 
             
                gr.HTML(f"""
         | 
| 79 | 
             
                <div id="page-header" style="text-align:center; margin-bottom:1rem;">
         | 
| 80 | 
             
                    <div id="left-container">
         | 
| 81 | 
            -
                        <img src="/gradio_api/file= | 
|  | |
| 82 | 
             
                    </div>
         | 
| 83 | 
             
                    <div id="centre-container">
         | 
| 84 | 
             
                        <h1 style="margin-bottom: 0.25rem;">{TITLE}</h1>
         | 
| @@ -102,8 +105,9 @@ with demo: | |
| 102 | 
             
                    with gr.TabItem("About", elem_id="llm-benchmark-tab-table", id=2):
         | 
| 103 | 
             
                        gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
         | 
| 104 |  | 
|  | |
| 105 |  | 
| 106 | 
             
            scheduler = BackgroundScheduler()
         | 
| 107 | 
             
            scheduler.add_job(restart_space, "interval", seconds=1800)
         | 
| 108 | 
             
            scheduler.start()
         | 
| 109 | 
            -
            demo.queue(default_concurrency_limit=40).launch(allowed_paths= | 
|  | |
| 72 | 
             
                    wrap=False,
         | 
| 73 | 
             
                )
         | 
| 74 |  | 
| 75 | 
            +
            black_logo_path = "src/assets/logo-icon-black.png"
         | 
| 76 | 
            +
            white_logo_path = "src/assets/logo-icon-white.png"
         | 
| 77 |  | 
| 78 | 
             
            demo = gr.Blocks(css=custom_css, theme=gr.themes.Default(primary_hue=gr.themes.colors.pink))
         | 
| 79 | 
             
            with demo:
         | 
| 80 | 
             
                gr.HTML(f"""
         | 
| 81 | 
             
                <div id="page-header" style="text-align:center; margin-bottom:1rem;">
         | 
| 82 | 
             
                    <div id="left-container">
         | 
| 83 | 
            +
                        <img id="black-logo" src="/gradio_api/file={black_logo_path}">
         | 
| 84 | 
            +
                        <img id="white-logo" src="/gradio_api/file={white_logo_path}">
         | 
| 85 | 
             
                    </div>
         | 
| 86 | 
             
                    <div id="centre-container">
         | 
| 87 | 
             
                        <h1 style="margin-bottom: 0.25rem;">{TITLE}</h1>
         | 
|  | |
| 105 | 
             
                    with gr.TabItem("About", elem_id="llm-benchmark-tab-table", id=2):
         | 
| 106 | 
             
                        gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
         | 
| 107 |  | 
| 108 | 
            +
            assets = [black_logo_path, white_logo_path]
         | 
| 109 |  | 
| 110 | 
             
            scheduler = BackgroundScheduler()
         | 
| 111 | 
             
            scheduler.add_job(restart_space, "interval", seconds=1800)
         | 
| 112 | 
             
            scheduler.start()
         | 
| 113 | 
            +
            demo.queue(default_concurrency_limit=40).launch(allowed_paths=assets)
         | 
    	
        src/assets/{logo-icon.png → logo-icon-black.png}
    RENAMED
    
    | 
											File without changes
										 | 
    	
        src/assets/logo-icon-white.png
    ADDED
    
    |   | 
    	
        src/display/css_html_js.py
    CHANGED
    
    | @@ -250,11 +250,19 @@ table.table { | |
| 250 | 
             
                flex: 1;
         | 
| 251 | 
             
            }
         | 
| 252 |  | 
| 253 | 
            -
            #left-container  | 
| 254 | 
             
                height: 150px;
         | 
| 255 | 
             
                width: 150px;
         | 
| 256 | 
             
            }
         | 
| 257 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 258 | 
             
            #centre-container {
         | 
| 259 | 
             
                align-self: center;
         | 
| 260 | 
             
            }
         | 
| @@ -263,6 +271,16 @@ table.table { | |
| 263 | 
             
                flex: 1;
         | 
| 264 | 
             
            }
         | 
| 265 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 266 | 
             
            """
         | 
| 267 |  | 
| 268 | 
             
            # .selected.svelte-1tcem6n.svelte-1tcem6n {
         | 
|  | |
| 250 | 
             
                flex: 1;
         | 
| 251 | 
             
            }
         | 
| 252 |  | 
| 253 | 
            +
            #left-container #black-logo, #left-container #white-logo {
         | 
| 254 | 
             
                height: 150px;
         | 
| 255 | 
             
                width: 150px;
         | 
| 256 | 
             
            }
         | 
| 257 |  | 
| 258 | 
            +
            #left-container #black-logo {
         | 
| 259 | 
            +
                display: block;
         | 
| 260 | 
            +
            }
         | 
| 261 | 
            +
             | 
| 262 | 
            +
            #left-container #white-logo {
         | 
| 263 | 
            +
                display: none;
         | 
| 264 | 
            +
            }
         | 
| 265 | 
            +
             | 
| 266 | 
             
            #centre-container {
         | 
| 267 | 
             
                align-self: center;
         | 
| 268 | 
             
            }
         | 
|  | |
| 271 | 
             
                flex: 1;
         | 
| 272 | 
             
            }
         | 
| 273 |  | 
| 274 | 
            +
            @media (prefers-color-scheme: dark) {
         | 
| 275 | 
            +
                #left-container #black-logo {
         | 
| 276 | 
            +
                    display: none;
         | 
| 277 | 
            +
                }    
         | 
| 278 | 
            +
                #left-container #white-logo {
         | 
| 279 | 
            +
                    display: block;
         | 
| 280 | 
            +
                }
         | 
| 281 | 
            +
            }
         | 
| 282 | 
            +
             | 
| 283 | 
            +
             | 
| 284 | 
             
            """
         | 
| 285 |  | 
| 286 | 
             
            # .selected.svelte-1tcem6n.svelte-1tcem6n {
         | 
