文件2.py
name1 = []
class VideoCamera(object):
def process_and_encode(images):
# initialize the list of known encodings and known names
known_encodings = []
known_names = []
name1 = []
print("[LOG] Encoding faces ...")
for image_path in tqdm(images):
# For Loading image
image = cv2.imread(image_path)
# Converting it from BGR to RGB
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# detect face in the image and get its location (square boxes coordinates)
boxes = face_recognition.face_locations(image, model='hog')
# Encode the face into a 128-d embeddings vector
encoding = face_recognition.face_encodings(image, boxes)
# the person's name is the name of the folder where the image comes from
name = image_path.split(os.path.sep)[-2]
if len(encoding) > 0:
known_encodings.append(encoding[0])
known_names.append(name)
name1.append(name)
print (name1)
return {"encodings": known_encodings, "names": known_names,"name1": name1}
main.py
from flask import Flask, render_template,request,session,Response
from flask_mysqldb import MySQL
from camera import *
from twilio.rest import Client
import time
import random
@app.route('/otp',methods=['POST'])
def otp():
print("Name")
print(name1)
if name1 == "Tejaswi":
return render_template('sucess.html')
else:
return render_template('failed.html')
在main.py[]中-正在打印空列表,而不是打印名称1的更新值。如何在此main.py.中打印gloabla变量值。。 现在我已经这样编辑了,但输出仍然是空列表
请帮帮我
好的,我编辑了一些东西。这里是file2.py
这是main.py
相关问题 更多 >
编程相关推荐