Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	test class names
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -68,9 +68,10 @@ def treat_grayscale(img): 
     | 
|
| 68 | 
         | 
| 69 | 
         
             
            def get_name_by_id(contiguous_id, ade20k_meta):
         
     | 
| 70 | 
         
             
                stuff_classes = ade20k_meta["stuff_classes"]
         
     | 
| 
         | 
|
| 71 | 
         | 
| 72 | 
         
             
                if contiguous_id < len(stuff_classes):
         
     | 
| 73 | 
         
            -
                    return stuff_classes[contiguous_id]
         
     | 
| 74 | 
         | 
| 75 | 
         
             
                return "Unknown"
         
     | 
| 76 | 
         | 
| 
         @@ -115,7 +116,7 @@ gui = gr.Interface( 
     | 
|
| 115 | 
         
             
                predict,
         
     | 
| 116 | 
         
             
                inputs=[
         
     | 
| 117 | 
         
             
                    gr.Image(type='filepath', label="Input Image"),
         
     | 
| 118 | 
         
            -
                    gr.Textbox(type='text', label="Input Image (URL)"),
         
     | 
| 119 | 
         
             
                    gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.05, label="Confidence Threshold")
         
     | 
| 120 | 
         
             
                ],
         
     | 
| 121 | 
         
             
                outputs=[
         
     | 
| 
         @@ -124,7 +125,8 @@ gui = gr.Interface( 
     | 
|
| 124 | 
         
             
                    gr.Textbox(type='text', label="Predictions (JSON)")
         
     | 
| 125 | 
         
             
                ],
         
     | 
| 126 | 
         
             
                examples=[
         
     | 
| 127 | 
         
            -
                    ["https://puam-loris.aws.princeton.edu/loris/INV33883.jp2/full/full/0/default.jpg", "", 0.05]
         
     | 
| 
         | 
|
| 128 | 
         
             
                ],
         
     | 
| 129 | 
         
             
            )
         
     | 
| 130 | 
         | 
| 
         | 
|
| 68 | 
         | 
| 69 | 
         
             
            def get_name_by_id(contiguous_id, ade20k_meta):
         
     | 
| 70 | 
         
             
                stuff_classes = ade20k_meta["stuff_classes"]
         
     | 
| 71 | 
         
            +
                ids = ade20k_meta["stuff_dataset_id_to_contiguous_id"]
         
     | 
| 72 | 
         | 
| 73 | 
         
             
                if contiguous_id < len(stuff_classes):
         
     | 
| 74 | 
         
            +
                    return stuff_classes[ids[contiguous_id]]
         
     | 
| 75 | 
         | 
| 76 | 
         
             
                return "Unknown"
         
     | 
| 77 | 
         | 
| 
         | 
|
| 116 | 
         
             
                predict,
         
     | 
| 117 | 
         
             
                inputs=[
         
     | 
| 118 | 
         
             
                    gr.Image(type='filepath', label="Input Image"),
         
     | 
| 119 | 
         
            +
                    gr.Textbox(type='text', label="Input Image (URL) - not considered if image was uploaded"),
         
     | 
| 120 | 
         
             
                    gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.05, label="Confidence Threshold")
         
     | 
| 121 | 
         
             
                ],
         
     | 
| 122 | 
         
             
                outputs=[
         
     | 
| 
         | 
|
| 125 | 
         
             
                    gr.Textbox(type='text', label="Predictions (JSON)")
         
     | 
| 126 | 
         
             
                ],
         
     | 
| 127 | 
         
             
                examples=[
         
     | 
| 128 | 
         
            +
                    ["https://puam-loris.aws.princeton.edu/loris/INV33883.jp2/full/full/0/default.jpg", "", 0.05],
         
     | 
| 129 | 
         
            +
                    ["", "https://upload.wikimedia.org/wikipedia/commons/6/62/Gaspar_Peeter_Verbruggen_d.%C3%86._-_Blomsterkrans_med_Johannes_D%C3%B8beren_-_KMSsp332_-_Statens_Museum_for_Kunst.jpg", 0.35]
         
     | 
| 130 | 
         
             
                ],
         
     | 
| 131 | 
         
             
            )
         
     | 
| 132 | 
         |