How to use sliders method in pyatom

Best Python code snippet using pyatom_python

mode_selector.py

Source:mode_selector.py Github

copy

Full Screen

1from render_modes import *2def render_with_mode(rendering_mode, sliders_ajax, main_frame, frame_background,3 f, f1, yolo_network, rcnn_network, caffe_network, superres_network,4 dain_network, esrgan_network, device, output_layers, classes_index, zip_obj, zip_is_opened,5 zipped_images, server_states, started_rendering_video6 ):7 # YOLO Modes8 # Find all boxes with classes9 if rendering_mode in ("extract_objects_yolo_mode", "text_render_yolo", "canny_people_on_black", "canny_people_on_background"):10 boxes, indexes, class_ids, confidences, classes_out = find_yolo_classes(11 main_frame,12 yolo_network,13 output_layers,14 int(sliders_ajax["confidenceSliderValue"])15 )16 classes_index.append(classes_out)17 # Draw boxes with labels on frame18 # Extract all image regions with objects and add them to zip19 if rendering_mode == 'extract_objects_yolo_mode':20 main_frame, zipped_images, zip_obj, zip_is_opened = extract_objects_yolo(21 main_frame,22 boxes,23 indexes,24 class_ids,25 confidences,26 zip_obj,27 zip_is_opened,28 zipped_images,29 server_states['source_mode'],30 started_rendering_video,31 )32 # If it is image, close zip immediately33 if server_states['source_mode'] == "image" and zip_is_opened:34 zip_obj.close()35 # Prepare zip to reopening36 if server_states['source_mode'] == "image" and not zipped_images:37 zipped_images = True38 zip_is_opened = False39 # Draw YOLO objects with ASCII effect40 if rendering_mode == 'text_render_yolo':41 main_frame = objects_to_text_yolo(42 main_frame,43 boxes,44 indexes,45 class_ids,46 int(sliders_ajax["asciiSizeSliderValue"]),47 int(sliders_ajax["asciiIntervalSliderValue"]),48 int(sliders_ajax["rcnnBlurSliderValue"]),49 int(sliders_ajax["asciiThicknessSliderValue"]),50 )51 # Draw YOLO objects with canny edge detection on black background52 if rendering_mode == 'canny_people_on_black':53 main_frame = canny_people_on_black_yolo(main_frame, boxes, indexes, class_ids)54 # Draw YOLO objects with canny edge detection on source colored background55 if rendering_mode == 'canny_people_on_background':56 main_frame = canny_people_on_background_yolo(main_frame, boxes, indexes, class_ids)57 # MASK R-CNN Modes58 # Convert background to grayscale and add color objects59 if rendering_mode == 'color_objects_on_gray':60 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)61 main_frame = colorizer_people_rcnn(62 main_frame,63 boxes,64 masks,65 int(sliders_ajax["confidenceSliderValue"]),66 int(sliders_ajax["rcnnSizeSliderValue"]),67 int(sliders_ajax["rcnnBlurSliderValue"]),68 )69 # Convert background to grayscale with blur and add color objects70 if rendering_mode == 'color_objects_on_gray_blur':71 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)72 main_frame = colorizer_people_with_blur_rcnn(73 main_frame,74 boxes,75 masks,76 int(sliders_ajax["confidenceSliderValue"])77 )78 # Blur background behind RCNN objects79 if rendering_mode == 'color_objects_blur':80 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)81 main_frame = people_with_blur_rcnn(82 main_frame,83 boxes,84 masks,85 labels,86 int(sliders_ajax["confidenceSliderValue"]),87 int(sliders_ajax["rcnnSizeSliderValue"]),88 int(sliders_ajax["rcnnBlurSliderValue"]),89 )90 # Draw MASK R-CNN objects with canny edge detection on black background91 if rendering_mode == 'extract_and_cut_background':92 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)93 main_frame = extract_and_cut_background_rcnn(94 main_frame,95 boxes,96 masks,97 labels,98 int(sliders_ajax["confidenceSliderValue"])99 )100 # Draw MASK R-CNN objects on animated background101 if rendering_mode == 'extract_and_replace_background':102 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)103 main_frame = extract_and_replace_background_rcnn(104 main_frame,105 frame_background,106 boxes,107 masks,108 labels,109 colors,110 int(sliders_ajax["confidenceSliderValue"]),111 int(sliders_ajax["cannyBlurSliderValue"]),112 int(sliders_ajax["cannyThresSliderValue"]),113 int(sliders_ajax["cannyThresSliderValue2"]),114 int(sliders_ajax["lineThicknessSliderValue"])115 )116 main_frame = denoise(117 main_frame,118 int(sliders_ajax["denoiseSliderValue"]),119 int(sliders_ajax["denoiseSliderValue2"]))120 # Draw MASK R-CNN objects with canny edge detection on canny blurred background121 if rendering_mode == 'color_canny':122 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)123 main_frame = color_canny_rcnn(124 main_frame,125 boxes,126 masks,127 labels,128 int(sliders_ajax["confidenceSliderValue"]),129 int(sliders_ajax["rcnnBlurSliderValue"]),130 int(sliders_ajax["cannyBlurSliderValue"]),131 int(sliders_ajax["cannyThresSliderValue"]),132 int(sliders_ajax["cannyThresSliderValue2"]),133 int(sliders_ajax["lineThicknessSliderValue"])134 )135 main_frame = denoise(136 main_frame,137 int(sliders_ajax["denoiseSliderValue"]),138 int(sliders_ajax["denoiseSliderValue2"]))139 # Draw MASK R-CNN objects with canny edge detection on source background140 if rendering_mode == 'color_canny_on_background':141 boxes, masks, labels, colors = find_rcnn_classes(main_frame, rcnn_network)142 main_frame = color_canny_on_color_background_rcnn(143 main_frame,144 boxes,145 masks,146 labels,147 int(sliders_ajax["confidenceSliderValue"])148 )149 # Grayscale frame color restoration with caffe neural network150 if rendering_mode == 'caffe_colorization':151 main_frame = colorizer_caffe(caffe_network, main_frame)152 # Cartoon effect (canny, dilate, color quantization with k-means, denoise, sharpen)153 if rendering_mode == 'cartoon_effect':154 main_frame = cartoon_effect(155 main_frame,156 int(sliders_ajax["cannyBlurSliderValue"]),157 int(sliders_ajax["cannyThresSliderValue"]),158 int(sliders_ajax["cannyThresSliderValue2"]),159 int(sliders_ajax["lineThicknessSliderValue"]),160 int(sliders_ajax["colorCountSliderValue"]),161 int(sliders_ajax["sharpenSliderValue"]),162 int(sliders_ajax["sharpenSliderValue2"]),163 int(sliders_ajax["denoiseSliderValue"]),164 int(sliders_ajax["denoiseSliderValue2"])165 )166 # Pencil drawer (canny, k-means quantization to 2 colors, denoise)167 if rendering_mode == 'pencil_drawer':168 main_frame = pencil_drawer(169 main_frame,170 int(sliders_ajax["cannyBlurSliderValue"]),171 int(sliders_ajax["cannyThresSliderValue"]),172 int(sliders_ajax["cannyThresSliderValue2"]),173 int(sliders_ajax["lineThicknessSliderValue"]),174 int(sliders_ajax["sharpenSliderValue"]),175 int(sliders_ajax["sharpenSliderValue2"]),176 int(sliders_ajax["denoiseSliderValue"]),177 int(sliders_ajax["denoiseSliderValue2"])178 )179 # Pencil drawer (k-means quantization to 2 colors, denoise)180 if rendering_mode == 'two_colored':181 main_frame = two_colored(182 main_frame,183 int(sliders_ajax["sharpenSliderValue"]),184 int(sliders_ajax["sharpenSliderValue2"]),185 int(sliders_ajax["denoiseSliderValue"]),186 int(sliders_ajax["denoiseSliderValue2"])187 )188 # Super-resolution upscaler with EDSR, LapSRN and FSRCNN189 if rendering_mode == 'upscale_opencv':190 main_frame = upscale_with_superres(superres_network, main_frame)191 main_frame = sharpening(192 main_frame,193 int(sliders_ajax["sharpenSliderValue"]),194 int(sliders_ajax["sharpenSliderValue2"])195 )196 # Super-resolution upscaler with ESRGAN (FALCOON, MANGA, PSNR models)197 if rendering_mode == 'upscale_esrgan':198 main_frame = upscale_with_esrgan(esrgan_network, device, main_frame)199 main_frame = sharpening(200 main_frame,201 int(sliders_ajax["sharpenSliderValue"]),202 int(sliders_ajax["sharpenSliderValue2"])203 )204 # Draw frame with ASCII chars205 if rendering_mode == 'ascii_painter':206 main_frame = ascii_paint(207 main_frame,208 int(sliders_ajax["asciiSizeSliderValue"]),209 int(sliders_ajax["asciiIntervalSliderValue"]),210 int(sliders_ajax["asciiThicknessSliderValue"]),211 int(sliders_ajax["rcnnBlurSliderValue"]),212 attach_to_color=True213 )214 # Denoise and sharpen215 if rendering_mode == 'denoise_and_sharpen':216 main_frame = sharpening(217 main_frame,218 int(sliders_ajax["sharpenSliderValue"]),219 int(sliders_ajax["sharpenSliderValue2"]))220 main_frame = denoise(221 main_frame,222 int(sliders_ajax["denoiseSliderValue"]),223 int(sliders_ajax["denoiseSliderValue2"]))224 # Sobel filter225 if rendering_mode == 'sobel':226 main_frame = sobel(227 main_frame,228 int(sliders_ajax["denoiseSliderValue"]),229 int(sliders_ajax["denoiseSliderValue2"]),230 int(sliders_ajax["sharpenSliderValue"]),231 int(sliders_ajax["sharpenSliderValue2"]),232 int(sliders_ajax["sobelSliderValue"])233 )234 # Boost fps with Depth-Aware Video Frame Interpolation235 # Process interpolation only if user pressed START button236 frame_boost_sequence = None237 frame_boost_list = None238 if rendering_mode == 'boost_fps_dain' and started_rendering_video:239 frame_boost_sequence, frame_boost_list = boost_fps_with_dain(240 dain_network, f, f1, 8, True241 )242 # Apply brightness and contrast modes_ajax for all modes243 main_frame = adjust_br_contrast(main_frame, int(sliders_ajax["contrastSliderValue"]),244 int(sliders_ajax["brightnessSliderValue"]))245 main_frame = adjust_saturation(main_frame, int(sliders_ajax["saturationSliderValue"]))...

Full Screen

Full Screen

views.py

Source:views.py Github

copy

Full Screen

1from django.shortcuts import render23from .models import Slider1, Insumos, MisionyVision,Galeria45from django.contrib.auth.models import User6from django.contrib.auth import authenticate, logout, login as login_au7from django.contrib.auth.decorators import login_required, permission_required89# Create your views here.10def index(request):11 sliders = Slider1.objects.all()12 return render(request,'web/index.html',{'imagenes':sliders})131415161718def galeria(request):19 galeria = Galeria.objects.all()2021 sliders = Slider1.objects.all()22 return render(request,'web/galeria.html',{'imagenes':sliders, 'imageness':galeria})23 2425262728def ubicacion(request):29 sliders = Slider1.objects.all()30 return render(request,'web/ubicacion.html',{'imagenes':sliders})31323334353637@login_required(login_url='/login/')38@permission_required('miProyectodwy.change_insumos', login_url='/login/')39def modificar(request):40 if request.POST:41 nombre = request.POST.get("txtnombre")42 precio = request.POST.get("txtprecio")43 descripcion = request.POST.get("txtdescripcion")44 stock = request.POST.get("txtstock")4546 try:47 insumo = Insumos.objects.get(nombre=nombre)48 insumo.precio = precio49 insumo.descripcion = descripcion50 insumo.stock = stock51 insumo.save()52 msg='Insumo Modicado'53 except :54 msg='No Modifico Insumo '55 lista = Insumos.objects.all()56 sliders = Slider1.objects.all()57 return render(request,'web/admin_insumos.html',{'lista_insumos':lista, 'msg':msg,'imagenes':sliders}) 5859 606162636465@login_required(login_url='/login/')66def buscar(request,id):67 try:68 insumo = Insumos.objects.get(nombre=id)69 sliders = Slider1.objects.all()70 return render(request,'web/formulario_insumo_modificar.html',{'insumo':insumo,'imagenes':sliders})71 except:72 msg='No existe insumo'73 lista = Insumos.objects.all()74 sliders = Slider1.objects.all()75 return render(request,'web/admin_insumos.html',{'lista_insumos':lista, 'msg':msg,'imagenes':sliders})76777879@login_required(login_url='/login/')80@permission_required('auth.add_user',login_url='/login/')81def formulario_registro(request):82 83 if request.POST:84 nombre = request.POST.get("txtnombre")85 apellido = request.POST.get("txtapellido")86 email = request.POST.get("txtemail")87 usuario = request.POST.get("txtnombreusuario")88 contra1 = request.POST.get("txtcontraseña1")89 contra2 = request.POST.get("txtcontraseña2")90 try:91 usu = User.objects.get(username=usuario)92 sliders = Slider1.objects.all()93 return render(request,'web/formulario_registro.html',{'msg':'Usuario ya existe','imagenes':sliders})94 95 except:96 try:97 usu = User.objects.get(email=email)98 sliders = Slider1.objects.all()99 return render(request,'web/formulario_registro.html',{'msg':'Email ya existe','imagenes':sliders})100 except :101 102 if contra1!=contra2:103 sliders = Slider1.objects.all()104 return render(request,'web/formulario_registro.html',{'msg':'Claves no Coinciden','imagenes':sliders})105 106 usu=User()107 usu.first_name = nombre108 usu.last_name = apellido109 usu.email = email110 usu.username = usuario111 usu.set_password(contra1)112113 usu.save()114 usu = authenticate(request, username=usuario, password=contra1)115 login_au(request,usu)116 sliders = Slider1.objects.all()117 return render(request,'web/index.html',{'imagenes':sliders})118119 sliders = Slider1.objects.all()120 return render(request,'web/formulario_registro.html',{'imagenes':sliders})121122123124125126127128129def mision_vision(request):130 lista = MisionyVision.objects.all()131 sliders = Slider1.objects.all()132 return render(request,'web/mision_vision.html',{'imagenes':sliders,'lista':lista})133 134135136137138139140@login_required(login_url='/login/')141@permission_required('miProyectodwy.view_insumos', login_url='/login/')142@permission_required('miProyectodwy.delete_insumos', login_url='/login/')143def eliminar_insumo(request,id):144 try:145 insumo = Insumos.objects.get(nombre=id)146 insumo.delete()147 msg='Insumo Eliminado'148 except :149 msg='No Elimino Insumo'150 lista = Insumos.objects.all()151 sliders = Slider1.objects.all()152 return render(request,'web/admin_insumos.html',{'lista_insumos':lista, 'msg':msg,'imagenes':sliders})153154155156157158159160161@login_required(login_url='/login/')162@permission_required('miProyectodwy.view_insumos', login_url='/login/')163def lista_insumos(request):164 lista = Insumos.objects.all() 165 sliders = Slider1.objects.all()166 return render(request,'web/admin_insumos.html',{'lista_insumos':lista,'imagenes':sliders})167168169170171172173174175176@login_required(login_url='/login/')177@permission_required('miProyectodwy.add_insumos', login_url='/login/')178@permission_required('miProyectodwy.change_insumos', login_url='/login/')179def formulario_insumos(request):180 if request.POST:181 nombre = request.POST.get("txtnombre")182 precio = request.POST.get("txtprecio")183 descripcion = request.POST.get("txtdescripcion")184 stock = request.POST.get("txtstock")185186 insumo= Insumos(187 nombre=nombre,188 precio=precio,189 descripcion=descripcion,190 stock=stock191 )192193 insumo.save()194 sliders = Slider1.objects.all()195 return render(request,'web/formulario_insumos.html',{'msg':'Grabo Insumo correctamente','imagenes':sliders})196197 sliders = Slider1.objects.all()198 return render(request,'web/formulario_insumos.html',{'imagenes':sliders})199200201202203204205206207208209def login(request):210 211 if request.POST:212 usuario = request.POST.get("txtnombreusuario")213 password = request.POST.get("txtcontraseña1")214 usu = authenticate(request, username=usuario, password=password)215 if usu is not None and usu.is_active:216 login_au(request,usu)217218 sliders = Slider1.objects.all()219 return render(request,'web/index.html',{'imagenes':sliders})220221 222 else:223 sliders = Slider1.objects.all()224 return render(request,'web/login.html',{'msg': 'No existe usuario','imagenes':sliders}) 225226 sliders = Slider1.objects.all() 227 return render(request,'web/login.html',{'imagenes':sliders})228229230231232233234235236237238239def cerrar(request):240 logout(request)241 sliders = Slider1.objects.all() ...

Full Screen

Full Screen

problems.py

Source:problems.py Github

copy

Full Screen

1"""2SLIDERS PROBLEM SET, FOR TESTING3"""4import numpy as np5from search import *6from sliders import *7PROBLEMS = (8 9 SlidersState("START", 0, None, 2, 2,10 np.array([[1,0],[3,2]])11 ), 12 SlidersState("START", 0, None, 2, 2,13 np.array([[3,2],[1,0]])14 ), 15 SlidersState("START", 0, None, 3, 3,16 np.array([[2, 0, 1],[3, 4, 5], [6,7,8]])17 ), 18 SlidersState("START", 0, None, 3, 3,19 np.array([[2, 0, 1],[4, 5,3], [7,8,6]])20 ), 21 SlidersState("START", 0, None, 3, 3,22 np.array([[3, 1, 2],[6, 4, 5], [0,7,8]])23 ), 24 SlidersState("START", 0, None, 3, 3,25 np.array([[2, 0, 1],[3, 4, 5], [6,7,8]])26 ), 27 SlidersState("START", 0, None, 3, 4,28 np.array([[1,2,3],[4,5,6], [7,8,9],[10,11,0]])29 ),30 SlidersState("START", 0, None, 3, 4,31 np.array([[1,2,3],[4,5,6], [0,7,8],[9,10,11]])32 ),33 SlidersState("START", 0, None, 3, 4,34 np.array([[1,2,3],[4,5,6], [0,7,8],[9,10,11]])35 ),36 SlidersState("START", 0, None, 3, 4,37 np.array([[1,2,3],[4,5,6], [0,7,8],[9,10,11]])38 ),39 SlidersState("START", 0, None, 5, 5,40 np.array([[1,2,3,9,10],[4,5,6,11,12], [0,7,8,13,14], [15,16,17,18,19],[20,21,22,23,24]])41 ) ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful