Spaces:
				
			
			
	
			
			
					
		Running
		
			on 
			
			CPU Upgrade
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
			on 
			
			CPU Upgrade
	
		Clémentine
		
	commited on
		
		
					Commit 
							
							·
						
						248ce7d
	
1
								Parent(s):
							
							8ba35a3
								
remove CI
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ import time 
     | 
|
| 4 | 
         
             
            import datetime
         
     | 
| 5 | 
         
             
            import gradio as gr
         
     | 
| 6 | 
         
             
            import datasets
         
     | 
| 7 | 
         
            -
            from huggingface_hub import snapshot_download 
     | 
| 8 | 
         
             
            from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
         
     | 
| 9 | 
         | 
| 10 | 
         
             
            from src.display.about import (
         
     | 
| 
         @@ -212,37 +212,4 @@ with demo: 
     | 
|
| 212 | 
         
             
                demo.load(fn=get_latest_data_leaderboard, inputs=[leaderboard], outputs=[leaderboard])
         
     | 
| 213 | 
         | 
| 214 | 
         | 
| 215 | 
         
            -
            demo.queue(default_concurrency_limit=40)
         
     | 
| 216 | 
         
            -
             
     | 
| 217 | 
         
            -
            # Start ephemeral Spaces on PRs (see config in README.md)
         
     | 
| 218 | 
         
            -
            from gradio_space_ci.webhook import IS_EPHEMERAL_SPACE, SPACE_ID, configure_space_ci
         
     | 
| 219 | 
         
            -
             
     | 
| 220 | 
         
            -
            def enable_space_ci_and_return_server(ui: gr.Blocks) -> WebhooksServer:
         
     | 
| 221 | 
         
            -
                # Taken from https://huggingface.co/spaces/Wauplin/gradio-space-ci/blob/075119aee75ab5e7150bf0814eec91c83482e790/src/gradio_space_ci/webhook.py#L61
         
     | 
| 222 | 
         
            -
                # Compared to original, this one do not monkeypatch Gradio which allows us to define more webhooks.
         
     | 
| 223 | 
         
            -
                # ht to Lucain!
         
     | 
| 224 | 
         
            -
                if SPACE_ID is None:
         
     | 
| 225 | 
         
            -
                    print("Not in a Space: Space CI disabled.")
         
     | 
| 226 | 
         
            -
                    return WebhooksServer(ui=demo)
         
     | 
| 227 | 
         
            -
             
     | 
| 228 | 
         
            -
                if IS_EPHEMERAL_SPACE:
         
     | 
| 229 | 
         
            -
                    print("In an ephemeral Space: Space CI disabled.")
         
     | 
| 230 | 
         
            -
                    return WebhooksServer(ui=demo)
         
     | 
| 231 | 
         
            -
             
     | 
| 232 | 
         
            -
                card = RepoCard.load(repo_id_or_path=SPACE_ID, repo_type="space")
         
     | 
| 233 | 
         
            -
                config = card.data.get("space_ci", {})
         
     | 
| 234 | 
         
            -
                print(f"Enabling Space CI with config from README: {config}")
         
     | 
| 235 | 
         
            -
             
     | 
| 236 | 
         
            -
                return configure_space_ci(
         
     | 
| 237 | 
         
            -
                    blocks=ui,
         
     | 
| 238 | 
         
            -
                    trusted_authors=config.get("trusted_authors"),
         
     | 
| 239 | 
         
            -
                    private=config.get("private", "auto"),
         
     | 
| 240 | 
         
            -
                    variables=config.get("variables", "auto"),
         
     | 
| 241 | 
         
            -
                    secrets=config.get("secrets"),
         
     | 
| 242 | 
         
            -
                    hardware=config.get("hardware"),
         
     | 
| 243 | 
         
            -
                    storage=config.get("storage"),
         
     | 
| 244 | 
         
            -
                )
         
     | 
| 245 | 
         
            -
             
     | 
| 246 | 
         
            -
            # Create webhooks server (with CI url if in Space and not ephemeral)
         
     | 
| 247 | 
         
            -
            webhooks_server = enable_space_ci_and_return_server(ui=demo)
         
     | 
| 248 | 
         
            -
            webhooks_server.launch()
         
     | 
| 
         | 
|
| 4 | 
         
             
            import datetime
         
     | 
| 5 | 
         
             
            import gradio as gr
         
     | 
| 6 | 
         
             
            import datasets
         
     | 
| 7 | 
         
            +
            from huggingface_hub import snapshot_download
         
     | 
| 8 | 
         
             
            from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
         
     | 
| 9 | 
         | 
| 10 | 
         
             
            from src.display.about import (
         
     | 
| 
         | 
|
| 212 | 
         
             
                demo.load(fn=get_latest_data_leaderboard, inputs=[leaderboard], outputs=[leaderboard])
         
     | 
| 213 | 
         | 
| 214 | 
         | 
| 215 | 
         
            +
            demo.queue(default_concurrency_limit=40).launch()
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         |