mirror of
				https://github.com/qurator-spk/sbb_binarization.git
				synced 2025-10-31 09:34:14 +01:00 
			
		
		
		
	ocrd cli: "model" parameter replaceable by SBB_BINARIZE_DATA envvar
This commit is contained in:
		
							parent
							
								
									3e60a62469
								
							
						
					
					
						commit
						0c31eaf6b1
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -19,7 +19,7 @@ | ||||||
|         "model": { |         "model": { | ||||||
|           "description": "models directory.", |           "description": "models directory.", | ||||||
|           "type": "string", |           "type": "string", | ||||||
|           "required": true |           "required": false | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -37,6 +37,14 @@ class SbbBinarizeProcessor(Processor): | ||||||
|     def __init__(self, *args, **kwargs): |     def __init__(self, *args, **kwargs): | ||||||
|         kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL] |         kwargs['ocrd_tool'] = OCRD_TOOL['tools'][TOOL] | ||||||
|         kwargs['version'] = OCRD_TOOL['version'] |         kwargs['version'] = OCRD_TOOL['version'] | ||||||
|  |         if not(kwargs.get('show_help', None) or kwargs.get('dump_json', None) or kwargs.get('show_version')): | ||||||
|  |             if not 'parameter' in kwargs: | ||||||
|  |                 kwargs['parameter'] = {} | ||||||
|  |             if not 'model' in kwargs['parameter']: | ||||||
|  |                 if 'SBB_BINARIZE_DATA' in os.environ: | ||||||
|  |                     kwargs['parameter']['model'] = os.environ['SBB_BINARIZE_DATA'] | ||||||
|  |                 else: | ||||||
|  |                     raise ValueError("Must pass 'model' parameter or set SBB_BINARIZE_DATA environment variable") | ||||||
|         super().__init__(*args, **kwargs) |         super().__init__(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def process(self): |     def process(self): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue