Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	
		baixintech_zhangyiming_prod
		
	commited on
		
		
					Commit 
							
							·
						
						a68994f
	
1
								Parent(s):
							
							53a3db7
								
import grc
Browse files
    	
        app.py
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 | 
             
            import gradio as gr
         | 
|  | |
| 2 | 
             
            from wmdetection.models import get_watermarks_detection_model
         | 
| 3 | 
             
            from wmdetection.pipelines.predictor import WatermarksPredictor
         | 
| 4 | 
             
            import os, glob
         | 
| @@ -22,6 +23,6 @@ def predict(image, threshold=0.5): | |
| 22 | 
             
            examples = glob.glob(os.path.join('images', 'clean', '*'))
         | 
| 23 | 
             
            examples.extend(glob.glob(os.path.join('images', 'watermark', '*')))
         | 
| 24 | 
             
            examples = [[e, 0.5] for e in examples]
         | 
| 25 | 
            -
            iface = gr.Interface(fn=predict, inputs=[ | 
| 26 | 
            -
                         examples=examples, outputs=[ | 
| 27 | 
             
            iface.launch()
         | 
|  | |
| 1 | 
             
            import gradio as gr
         | 
| 2 | 
            +
            import gradio.components as grc
         | 
| 3 | 
             
            from wmdetection.models import get_watermarks_detection_model
         | 
| 4 | 
             
            from wmdetection.pipelines.predictor import WatermarksPredictor
         | 
| 5 | 
             
            import os, glob
         | 
|  | |
| 23 | 
             
            examples = glob.glob(os.path.join('images', 'clean', '*'))
         | 
| 24 | 
             
            examples.extend(glob.glob(os.path.join('images', 'watermark', '*')))
         | 
| 25 | 
             
            examples = [[e, 0.5] for e in examples]
         | 
| 26 | 
            +
            iface = gr.Interface(fn=predict, inputs=[grc.Image(type="pil"), grc.Number(label="threshold", default=0.5)], 
         | 
| 27 | 
            +
                         examples=examples, outputs=[grc.Textbox(label="class"), grc.Textbox(label="wm_confidence")])
         | 
| 28 | 
             
            iface.launch()
         |