mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp.git
				synced 2025-10-31 12:52:47 +00:00 
			
		
		
		
	Update for unprivileged usage.
This commit is contained in:
		| @@ -37,4 +37,7 @@ RUN pip3 install wheel && pip3 install -U spacy && \ | ||||
| COPY nlp /usr/local/bin | ||||
| COPY spacy_nlp /usr/local/bin | ||||
|  | ||||
| mkdir /input /output | ||||
| chmod a+rw /input /output | ||||
|  | ||||
| ENTRYPOINT ["nlp"] | ||||
|   | ||||
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							| @@ -44,12 +44,12 @@ mkdir -p /<mydatalocation>/files_for_nlp /<mydatalocation>/files_from_nlp | ||||
| docker run \ | ||||
|     --rm \ | ||||
|     -it \ | ||||
|     -v /<mydatalocation>/files_for_nlp:/files_for_nlp \ | ||||
|     -v /<mydatalocation>/files_from_nlp:/files_from_nlp \ | ||||
|     -v /<mydatalocation>/files_for_nlp:/input \ | ||||
|     -v /<mydatalocation>/files_from_nlp:/output \ | ||||
|     sfb1288inf/nlp:latest \ | ||||
|         -i /files_for_nlp \ | ||||
|         -o /files_from_nlp \ | ||||
|         -l <languagecode> | ||||
|         -i /input \ | ||||
|         -l <languagecode> \ | ||||
|         -o /output | ||||
| ``` | ||||
| The arguments below `sfb1288inf/nlp:latest` are described in the [NLP arguments](#nlp-arguments) part. | ||||
|  | ||||
|   | ||||
							
								
								
									
										27
									
								
								wrapper/nlp
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								wrapper/nlp
									
									
									
									
									
								
							| @@ -10,22 +10,23 @@ parser = argparse.ArgumentParser(add_help=False) | ||||
| parser.add_argument( | ||||
|     '-i', | ||||
|     dest='input_dir', | ||||
|     required=False | ||||
|     required=True | ||||
| ) | ||||
| parser.add_argument( | ||||
|     '-o', | ||||
|     dest='output_dir', | ||||
|     required=False | ||||
|     required=True | ||||
| ) | ||||
| args, nlp_args = parser.parse_known_args() | ||||
| dirs, args = parser.parse_known_args() | ||||
|  | ||||
| if args.input_dir == None or args.output_dir == None: | ||||
|     if args.input_dir != None: | ||||
|         nlp_args.append('-i') | ||||
|         nlp_args.append('/files_for_nlp') | ||||
|     if args.output_dir != None: | ||||
|         nlp_args.append('-o') | ||||
|         nlp_args.append('/files_from_nlp') | ||||
|     subprocess.run(['docker', 'run', '--rm', '-it', container_image] + nlp_args) | ||||
| else: | ||||
|     subprocess.run(['docker', 'run', '--rm', '-it', '-v', args.input_dir + ':/files_for_nlp', '-v', args.output_dir + ':/files_from_nlp', container_image, '-i', '/files_for_nlp', '-o', '/files_from_nlp'] + nlp_args) | ||||
| cmd = ['docker', 'run', '--rm', '-it'] | ||||
| if dirs.input_dir is not None: | ||||
|     cmd += ['-v', dirs.input_dir + ':/input'] | ||||
|     args += ['-i', '/input'] | ||||
| if dirs.output_dir is not None: | ||||
|     cmd += ['-v', dirs.output_dir + ':/output'] | ||||
|     args += ['-o', '/output'] | ||||
| cmd.append(container_image) | ||||
| cmd += args | ||||
|  | ||||
| subprocess.run(cmd) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user