fix errors

This commit is contained in:
2023-05-25 15:17:57 +02:00
parent a0e7b459e1
commit cb35b3b9ff
2 changed files with 5 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ class Scaler:
print( '\n\n==>Photo upscaled' ); print( '\n\n==>Photo upscaled' );
def videoScaler ( self, tmppath, threads, scalefactor, sharpening, filetype, mode ): def videoScaler ( self, tmppath, threads, scalefactor, sharpening, filetype, mode ):
modes = { 'av3':'realesr-animevideov3', 'x4plus': 'realesrgan-x4plus-anime' }
print( '\n\n==> Preparing to upscale videos <==\n\n==> You will see a lot of numbers flying by showing the progress of the upscaling of each individual image.\n==> This process might take a long time, depending on the length of the video.\n\n') print( '\n\n==> Preparing to upscale videos <==\n\n==> You will see a lot of numbers flying by showing the progress of the upscaling of each individual image.\n==> This process might take a long time, depending on the length of the video.\n\n')
time.sleep( 2 ); time.sleep( 2 );
@@ -32,7 +33,7 @@ class Scaler:
except FileExistsError: except FileExistsError:
pass pass
if ( self.os_type == 'win32' ): if ( self.os_type == 'win32' ):
self.command = f'realesrgan-ncnn-vulkan -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {mode}' self.command = f'realesrgan-ncnn-vulkan -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {modes[ mode ]}'
elif ( self.os_type == 'linux' ): elif ( self.os_type == 'linux' ):
self.command = f'wine ./bin/lib/realesrgan-ncnn-vulkan.exe -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {mode}' self.command = f'wine ./bin/lib/realesrgan-ncnn-vulkan.exe -i {tmppath} -o {tmppath}sc -s {scalefactor} -j {threads}:{threads}:{threads} -n {modes[ mode ]}'
os.system( self.command ); os.system( self.command );

View File

@@ -50,7 +50,7 @@ def performChecks ( args, ap ):
return False return False
# Check scalefactor argument and also verify that engine supports upscaling # Check scalefactor argument and also verify that engine supports upscaling
if ( args.scalefactor != None ): if ( args.scalefactor != None and args.scalefactor != 0 ):
if ( int( args.scalefactor ) > 4 and int( args.scalefactor ) < -4 ): if ( int( args.scalefactor ) > 4 and int( args.scalefactor ) < -4 ):
print( '\n==> ERROR: Invalid scale factor. Value has to be an integer between -4 and 4' ) print( '\n==> ERROR: Invalid scale factor. Value has to be an integer between -4 and 4' )
return False return False
@@ -60,7 +60,7 @@ def performChecks ( args, ap ):
return False return False
# Check sharpening argument and also verify that engine supports it # Check sharpening argument and also verify that engine supports it
if ( args.sharpening != None ): if ( args.sharpening != None and args.sharpening != 0 ):
if ( float( args.sharpening ) >= 1 and float( args.sharpening ) <= 0 ): if ( float( args.sharpening ) >= 1 and float( args.sharpening ) <= 0 ):
print( '\n==> ERROR: Invalid value for sharpening. Value has to be between 0 and 1' ) print( '\n==> ERROR: Invalid value for sharpening. Value has to be between 0 and 1' )
return False return False