Spaces:
Runtime error
Runtime error
thuralinhtut
commited on
Commit
•
ca9772c
1
Parent(s):
aa29bda
Add application file
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- 0.jpg +0 -0
- 2.jpg +0 -0
- Dockerfile +24 -0
- app/PaperLayout.py +143 -0
- app/RemoveBg.py +110 -0
- app/__init__.py +0 -0
- app/__pycache__/PaperLayout.cpython-310.pyc +0 -0
- app/__pycache__/RemoveBg.cpython-310.pyc +0 -0
- app/__pycache__/__init__.cpython-310.pyc +0 -0
- app/__pycache__/admin.cpython-310.pyc +0 -0
- app/__pycache__/apiview.cpython-310.pyc +0 -0
- app/__pycache__/apps.cpython-310.pyc +0 -0
- app/__pycache__/models.cpython-310.pyc +0 -0
- app/__pycache__/serializers.cpython-310.pyc +0 -0
- app/__pycache__/tele.cpython-310.pyc +0 -0
- app/__pycache__/urls.cpython-310.pyc +0 -0
- app/__pycache__/views.cpython-310.pyc +0 -0
- app/admin.py +7 -0
- app/apiview.py +199 -0
- app/apps.py +6 -0
- app/haarcascade_frontalface_default.xml +0 -0
- app/migrations/0001_initial.py +69 -0
- app/migrations/__init__.py +0 -0
- app/migrations/__pycache__/0001_initial.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0002_remove_images_image_name_images_image_and_more.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0003_remove_images_user.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0004_images_img_qty.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0005_passportdetail_is_done.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0006_remove_passportdetail_user.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0007_alter_passportdetail_bgcolor.cpython-310.pyc +0 -0
- app/migrations/__pycache__/0008_remove_passportdetail_images_images_ppd.cpython-310.pyc +0 -0
- app/migrations/__pycache__/__init__.cpython-310.pyc +0 -0
- app/models.py +65 -0
- app/r11.jpg +0 -0
- app/serializers.py +26 -0
- app/tele.py +21 -0
- app/tests.py +3 -0
- app/urls.py +19 -0
- app/views.py +3 -0
- db.sqlite3 +0 -0
- haarcascade_frontalface_default.xml +0 -0
- manage.py +22 -0
- media/rawimg/23/05m/09d/1.png +0 -0
- media/rawimg/23/05m/09d/1_B8nghly.png +0 -0
- media/rawimg/23/05m/09d/1_YCYv09S.png +0 -0
- media/rawimg/23/05m/09d/1_drSLcYW.png +0 -0
- media/rawimg/23/05m/09d/1_mE8I4vg.png +0 -0
- media/rawimg/23/05m/09d/Screenshot_from_2023-03-27_16-31-00.png +0 -0
- media/rawimg/23/05m/09d/Screenshot_from_2023-04-03_01-35-18.png +0 -0
- passportapi/__init__.py +0 -0
0.jpg
ADDED
2.jpg
ADDED
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as the base image
|
2 |
+
FROM python:3.10
|
3 |
+
|
4 |
+
# Set environment variables
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
6 |
+
ENV PYTHONUNBUFFERED 1
|
7 |
+
|
8 |
+
# Set the working directory in the container
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Copy the requirements file to the working directory
|
12 |
+
COPY requirements.txt .
|
13 |
+
|
14 |
+
# Install project dependencies
|
15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
+
|
17 |
+
# Copy the project code to the working directory
|
18 |
+
COPY . .
|
19 |
+
|
20 |
+
# Expose the port your Django app will run on
|
21 |
+
EXPOSE 8000
|
22 |
+
|
23 |
+
# Run the Django development server
|
24 |
+
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
app/PaperLayout.py
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image
|
2 |
+
import math
|
3 |
+
import os
|
4 |
+
import subprocess
|
5 |
+
from .tele import SendToTele
|
6 |
+
|
7 |
+
|
8 |
+
class GeneratePhoto:
|
9 |
+
def __init__(self,paper_size,gap,images,img_max_width,img_max_height,raw_export):
|
10 |
+
self.paper_size = paper_size
|
11 |
+
self.gap = gap
|
12 |
+
self.images = images
|
13 |
+
self.img_max_width = img_max_width
|
14 |
+
self.img_max_height =img_max_height
|
15 |
+
self.raw_export = raw_export
|
16 |
+
|
17 |
+
def deleteimage(self,file_path):
|
18 |
+
# Check if the file exists before deleting
|
19 |
+
if os.path.exists(file_path):
|
20 |
+
# Delete the file
|
21 |
+
os.remove(file_path)
|
22 |
+
print("File deleted successfully.")
|
23 |
+
else:
|
24 |
+
print("File does not exist.")
|
25 |
+
|
26 |
+
def export(self):
|
27 |
+
paper_size = self.paper_size
|
28 |
+
gap = self.gap
|
29 |
+
|
30 |
+
images = self.images
|
31 |
+
img_max_width = self.img_max_width
|
32 |
+
img_max_height = self.img_max_height
|
33 |
+
|
34 |
+
#Calculate the images that how much fit inside the paper
|
35 |
+
limited_img_xaxis = int(paper_size[0] / (img_max_width + gap))
|
36 |
+
limited_img_yaxis = int(paper_size[1] / (img_max_height + gap))
|
37 |
+
|
38 |
+
|
39 |
+
limited_paper_images = limited_img_xaxis * limited_img_yaxis
|
40 |
+
img_qty = 0;
|
41 |
+
|
42 |
+
|
43 |
+
for (a,b) in images:
|
44 |
+
img_qty += int(b)
|
45 |
+
|
46 |
+
# print(math.ceil(img_qty/limited_paper_images))
|
47 |
+
|
48 |
+
# print('limited image',limited_paper_images)
|
49 |
+
# print(img_qty)
|
50 |
+
|
51 |
+
paper_qty = math.ceil(img_qty/limited_paper_images)
|
52 |
+
|
53 |
+
sets = [] # Initialize an empty list of sets
|
54 |
+
current_set = [] # Initialize an empty list to hold the images for the current set
|
55 |
+
|
56 |
+
# Iterate over the images
|
57 |
+
for image in images:
|
58 |
+
name, count = image
|
59 |
+
|
60 |
+
# Add the current image to the current set count times
|
61 |
+
for i in range(int(count)):
|
62 |
+
# If adding the current image would exceed the limit, add the current set to the list of sets and start a new set
|
63 |
+
if len(current_set) == limited_paper_images:
|
64 |
+
sets.append(current_set)
|
65 |
+
current_set = []
|
66 |
+
current_set.append(name)
|
67 |
+
|
68 |
+
# Add the last set to the list of sets
|
69 |
+
if current_set:
|
70 |
+
sets.append(current_set)
|
71 |
+
|
72 |
+
# Count the duplicate image names in each set and print the sets
|
73 |
+
count_set = []
|
74 |
+
|
75 |
+
for i, set in enumerate(sets):
|
76 |
+
name_counts = {}
|
77 |
+
for name in set:
|
78 |
+
if name in name_counts:
|
79 |
+
name_counts[name] += 1
|
80 |
+
else:
|
81 |
+
name_counts[name] = 1
|
82 |
+
# print(f"Name counts: {name_counts}")
|
83 |
+
count_set.append(name_counts)
|
84 |
+
|
85 |
+
|
86 |
+
print(count_set)
|
87 |
+
|
88 |
+
pname = 0
|
89 |
+
|
90 |
+
for p in count_set:
|
91 |
+
a4_image = Image.new('RGB', paper_size, color='white')
|
92 |
+
|
93 |
+
values_list = list(p.values())
|
94 |
+
key_list = list(p.keys())
|
95 |
+
|
96 |
+
|
97 |
+
imgs_sum = sum(values_list)
|
98 |
+
index = 0
|
99 |
+
|
100 |
+
print('Img : ', self.raw_export +os.path.basename(key_list[index]) )
|
101 |
+
|
102 |
+
img = Image.open(self.raw_export + os.path.basename(key_list[index]))
|
103 |
+
|
104 |
+
self.deleteimage(self.raw_export + os.path.basename(key_list[index]))
|
105 |
+
#Change pictures to Thumbnail
|
106 |
+
img = img.resize((int(img_max_width),int(img_max_height)),resample=Image.BICUBIC) #Resize Image
|
107 |
+
print(img.size,'Image size')
|
108 |
+
img.thumbnail((img_max_width,img_max_height))
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
for a in range(imgs_sum):
|
113 |
+
x_pos = a % limited_img_xaxis
|
114 |
+
y_pos = a // limited_img_xaxis
|
115 |
+
print(f"({x_pos}, {y_pos})")
|
116 |
+
|
117 |
+
position = (int(x_pos*img_max_width)+(gap*x_pos)+gap), int((y_pos*img_max_height)+(gap*y_pos)+gap)
|
118 |
+
|
119 |
+
print(position)
|
120 |
+
a4_image.paste(img,position)
|
121 |
+
|
122 |
+
if a == sum(values_list[:index+1])-1:
|
123 |
+
|
124 |
+
index += 1
|
125 |
+
try:
|
126 |
+
img = Image.open(self.raw_export+os.path.basename(key_list[index]))
|
127 |
+
img = img.resize((int(img_max_width),int(img_max_height)),resample=Image.BICUBIC) #Resize Image
|
128 |
+
print(img.size,'Resize Image')
|
129 |
+
img.thumbnail((img_max_width,img_max_height))
|
130 |
+
self.deleteimage(self.raw_export + os.path.basename(key_list[index]))
|
131 |
+
|
132 |
+
|
133 |
+
except IndexError:
|
134 |
+
print(IndexError)
|
135 |
+
|
136 |
+
pname += 1
|
137 |
+
|
138 |
+
pathname = 'paper/paper'+str(pname)+'.png'
|
139 |
+
a4_image.save(pathname)
|
140 |
+
SendToTele(document_path=pathname)
|
141 |
+
self.deleteimage(pathname)
|
142 |
+
|
143 |
+
|
app/RemoveBg.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
# import cvzone
|
3 |
+
# from cvzone.SelfiSegmentationModule import SelfiSegmentation
|
4 |
+
from PIL import Image
|
5 |
+
import rembg
|
6 |
+
# Load the input image
|
7 |
+
import os
|
8 |
+
|
9 |
+
import subprocess
|
10 |
+
from .tele import SendToTele
|
11 |
+
|
12 |
+
|
13 |
+
class RemoveBackground():
|
14 |
+
|
15 |
+
#images will be array
|
16 |
+
def __init__(self,images,aspect_ratio,rgb,output_di,bw=False):
|
17 |
+
self.images = images
|
18 |
+
self.aspect_ratio = aspect_ratio
|
19 |
+
self.rgb = rgb
|
20 |
+
self.output_di = output_di
|
21 |
+
self.bw = bw
|
22 |
+
self.model_name = "silueta"
|
23 |
+
self.session = rembg.new_session(model_name=self.model_name)
|
24 |
+
|
25 |
+
def deleteimage(self,file_path):
|
26 |
+
# Check if the file exists before deleting
|
27 |
+
if os.path.exists(file_path):
|
28 |
+
# Delete the file
|
29 |
+
os.remove(file_path)
|
30 |
+
print("File deleted successfully.")
|
31 |
+
else:
|
32 |
+
print("File does not exist.")
|
33 |
+
|
34 |
+
|
35 |
+
def remove(self):
|
36 |
+
aspect_ratio = self.aspect_ratio
|
37 |
+
|
38 |
+
for i in self.images:
|
39 |
+
print(i)
|
40 |
+
|
41 |
+
imgread = cv2.imread(i[0])
|
42 |
+
self.deleteimage(i[0])
|
43 |
+
if self.bw:
|
44 |
+
rgb = (128,128,128,0)
|
45 |
+
else:
|
46 |
+
rgb = (255,0,0,0)
|
47 |
+
|
48 |
+
img = rembg.remove(imgread,bgcolor=rgb, alpha_matting=True, alpha_matting_foreground_threshold=270,alpha_matting_background_threshold=20, alpha_matting_erode_size=11)
|
49 |
+
|
50 |
+
# Convert the image to grayscale
|
51 |
+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
52 |
+
|
53 |
+
# Load the face detector
|
54 |
+
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
|
55 |
+
|
56 |
+
if face_cascade.empty():
|
57 |
+
raise IOError('Unable to load the face cascade classifier xml file')
|
58 |
+
|
59 |
+
|
60 |
+
# Detect faces in the grayscale image
|
61 |
+
faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5)
|
62 |
+
|
63 |
+
if len(faces) > 0:
|
64 |
+
# Calculate the center of the bounding box
|
65 |
+
x, y, w, h = faces[0]
|
66 |
+
center_x = x + w // 2
|
67 |
+
center_y = y + h // 2
|
68 |
+
|
69 |
+
# Calculate the width and height of the cropped image
|
70 |
+
aspect_ratio = self.aspect_ratio
|
71 |
+
if w / h > aspect_ratio:
|
72 |
+
crop_width = int(aspect_ratio * h)
|
73 |
+
crop_height = h
|
74 |
+
else:
|
75 |
+
crop_width = w
|
76 |
+
crop_height = int(w / aspect_ratio)
|
77 |
+
|
78 |
+
# Calculate the coordinates of the top-left corner of the cropped image
|
79 |
+
margin_x = crop_width // 2
|
80 |
+
margin_y = crop_height // 2
|
81 |
+
crop_x = max(0, center_x - crop_width // 2 - margin_x)
|
82 |
+
crop_y = max(0, center_y - crop_height // 2 - margin_y)
|
83 |
+
|
84 |
+
# Crop the image
|
85 |
+
if self.bw:
|
86 |
+
crop_img = gray[crop_y:crop_y+crop_height+margin_y*2, crop_x:crop_x+crop_width+margin_x*2]
|
87 |
+
else:
|
88 |
+
crop_img = img[crop_y:crop_y+crop_height+margin_y*2, crop_x:crop_x+crop_width+margin_x*2]
|
89 |
+
|
90 |
+
else:
|
91 |
+
print("Face not detect")
|
92 |
+
|
93 |
+
basename =os.path.basename(i[0])
|
94 |
+
|
95 |
+
cv2.imwrite(self.output_di+basename,crop_img)
|
96 |
+
SendToTele(document_path=self.output_di+basename)
|
97 |
+
|
98 |
+
# images = {('img.jpg',5)}
|
99 |
+
# paper_size = (1200,1800)
|
100 |
+
# gap = 40; # gap between images;
|
101 |
+
|
102 |
+
# img_max_width = 1.1 * 300
|
103 |
+
# img_max_height = 1.3 * 300
|
104 |
+
|
105 |
+
|
106 |
+
# aspect_ratio = img_max_width / img_max_height
|
107 |
+
# bg_rgb = (255,0,0)
|
108 |
+
# output_di = 'img/'
|
109 |
+
# a = RemoveBackground(images,aspect_ratio,bg_rgb,output_di,True)
|
110 |
+
# a.remove()
|
app/__init__.py
ADDED
File without changes
|
app/__pycache__/PaperLayout.cpython-310.pyc
ADDED
Binary file (2.72 kB). View file
|
|
app/__pycache__/RemoveBg.cpython-310.pyc
ADDED
Binary file (2.4 kB). View file
|
|
app/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (141 Bytes). View file
|
|
app/__pycache__/admin.cpython-310.pyc
ADDED
Binary file (312 Bytes). View file
|
|
app/__pycache__/apiview.cpython-310.pyc
ADDED
Binary file (4.13 kB). View file
|
|
app/__pycache__/apps.cpython-310.pyc
ADDED
Binary file (403 Bytes). View file
|
|
app/__pycache__/models.cpython-310.pyc
ADDED
Binary file (2.47 kB). View file
|
|
app/__pycache__/serializers.cpython-310.pyc
ADDED
Binary file (1.26 kB). View file
|
|
app/__pycache__/tele.cpython-310.pyc
ADDED
Binary file (905 Bytes). View file
|
|
app/__pycache__/urls.cpython-310.pyc
ADDED
Binary file (733 Bytes). View file
|
|
app/__pycache__/views.cpython-310.pyc
ADDED
Binary file (185 Bytes). View file
|
|
app/admin.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.contrib import admin
|
2 |
+
from . import models
|
3 |
+
# Register your models here.
|
4 |
+
# admin.site.register(models.User)
|
5 |
+
admin.site.register(models.PassportDetail)
|
6 |
+
admin.site.register(models.User)
|
7 |
+
admin.site.register(models.Images)
|
app/apiview.py
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datetime import timedelta
|
2 |
+
import operator
|
3 |
+
import functools
|
4 |
+
import collections
|
5 |
+
from collections import OrderedDict
|
6 |
+
from datetime import datetime
|
7 |
+
from rest_framework.views import APIView
|
8 |
+
from rest_framework.response import Response
|
9 |
+
from rest_framework.permissions import AllowAny
|
10 |
+
from rest_framework.generics import CreateAPIView
|
11 |
+
from rest_framework import status
|
12 |
+
from rest_framework.authtoken.models import Token
|
13 |
+
|
14 |
+
from django.core.exceptions import ObjectDoesNotExist
|
15 |
+
from django.contrib.auth import get_user_model
|
16 |
+
|
17 |
+
from django.utils import timezone
|
18 |
+
from . import models, serializers
|
19 |
+
from . import RemoveBg, PaperLayout
|
20 |
+
|
21 |
+
import json
|
22 |
+
from PIL import Image
|
23 |
+
import base64
|
24 |
+
|
25 |
+
def write_file_from_object_file(object_file, file_path):
|
26 |
+
file_data = base64.b64decode(object_file)
|
27 |
+
with open(file_path, 'wb') as file:
|
28 |
+
file.write(file_data)
|
29 |
+
|
30 |
+
|
31 |
+
class CreateUserApiView(CreateAPIView):
|
32 |
+
|
33 |
+
permission_classes = [AllowAny]
|
34 |
+
serializer_class = serializers.CreateUserSerializer
|
35 |
+
|
36 |
+
def post(self, request):
|
37 |
+
print('posteed')
|
38 |
+
print(request.data)
|
39 |
+
serializers = self.get_serializer(data=request.data)
|
40 |
+
serializers.is_valid(raise_exception=True)
|
41 |
+
self.perform_create(serializers)
|
42 |
+
headers = self.get_success_headers(serializers.data)
|
43 |
+
|
44 |
+
# Create a token than will be used for future auth
|
45 |
+
token = Token.objects.create(user=serializers.instance)
|
46 |
+
token_data = {'token': token.key}
|
47 |
+
|
48 |
+
return Response(
|
49 |
+
{**serializers.data, **token_data},
|
50 |
+
status=status.HTTP_201_CREATED,
|
51 |
+
headers=headers)
|
52 |
+
|
53 |
+
class SendImage(APIView):
|
54 |
+
def get(self,request):
|
55 |
+
|
56 |
+
return Response(status=status.HTTP_200_OK)
|
57 |
+
|
58 |
+
def post(self,request):
|
59 |
+
print(request.data)
|
60 |
+
image = request.data['image']
|
61 |
+
qty = request.data['qty']
|
62 |
+
|
63 |
+
size = request.data['img_size'] # img size
|
64 |
+
bw = request.data['bw'] # img is black or white
|
65 |
+
paper = request.data['paper_size'] # paper size to print out
|
66 |
+
bgcolor = request.data['bg_color']
|
67 |
+
|
68 |
+
try:
|
69 |
+
PPD = models.PassportDetail.objects.get(is_done=False)
|
70 |
+
except ObjectDoesNotExist:
|
71 |
+
#the passport detail dnexist create one
|
72 |
+
PPD = models.PassportDetail.objects.create(size=size,paper=paper,bgcolor=bgcolor)
|
73 |
+
|
74 |
+
if bw == "true":
|
75 |
+
PPD.bw = True
|
76 |
+
PPD.save()
|
77 |
+
|
78 |
+
models.Images.objects.create(image=image,img_qty=qty,ppd=PPD)
|
79 |
+
# models.Images.objects.create(image=image,img_qty=qty)
|
80 |
+
|
81 |
+
return Response(PPD.id)
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
class GenerateImage(APIView):
|
86 |
+
def get(self,request):
|
87 |
+
PDDID = request.GET.get('pdid')
|
88 |
+
|
89 |
+
PD = models.PassportDetail.objects.get(id=PDDID)
|
90 |
+
PD.is_done = True
|
91 |
+
PD.save()
|
92 |
+
|
93 |
+
images_list = models.Images.objects.filter(ppd=PD)
|
94 |
+
images = []
|
95 |
+
for img in images_list:
|
96 |
+
print(img)
|
97 |
+
images.append((img.image.url[1:],img.img_qty))
|
98 |
+
|
99 |
+
paper_size = tuple(int(x) for x in PD.paper.split(","))
|
100 |
+
|
101 |
+
img_size = tuple(float(x) for x in PD.size.split(","))
|
102 |
+
bg_color = tuple(int(x) for x in PD.bgcolor.split(","))
|
103 |
+
|
104 |
+
gap = 40; # gap between images;
|
105 |
+
|
106 |
+
img_max_width = img_size[0] * 300
|
107 |
+
img_max_height = img_size[1] * 300
|
108 |
+
aspect_ratio = img_max_width / img_max_height
|
109 |
+
output_di = 'img/'
|
110 |
+
|
111 |
+
print("Start Removing",PD.bw)
|
112 |
+
RemoveBg.RemoveBackground(images,aspect_ratio,bg_color,output_di,PD.bw).remove()
|
113 |
+
PaperLayout.GeneratePhoto(paper_size,gap,images,img_max_width,img_max_height,raw_export=output_di).export()
|
114 |
+
|
115 |
+
print("end Removing")
|
116 |
+
|
117 |
+
|
118 |
+
return Response(status=status.HTTP_200_OK)
|
119 |
+
|
120 |
+
# const token = '5499662958:AAEAoWy0khLJMf238ZwvvEoBV1FKfaVF6S0';
|
121 |
+
# const chatid = '-618629809';
|
122 |
+
#
|
123 |
+
# 'https://api.telegram.org/bot' +
|
124 |
+
# token +
|
125 |
+
# '/sendDocument?chat_id=' +
|
126 |
+
# chatid;
|
127 |
+
|
128 |
+
|
129 |
+
# class SalesTwoDigits(APIView):
|
130 |
+
# # permission_classes = [AllowAny]P
|
131 |
+
|
132 |
+
# def get(self, request):
|
133 |
+
# user = get_user_model().objects.get(username=request.user,is_plan=True,
|
134 |
+
# is_salesDigits=True)
|
135 |
+
|
136 |
+
# try:
|
137 |
+
# G = models.TwoDigitsGroup.objects.get(user=user, is_done=False)
|
138 |
+
# print('Group M Exists')
|
139 |
+
# except ObjectDoesNotExist:
|
140 |
+
# print('Group M Not Exits')
|
141 |
+
# G = models.TwoDigitsGroup.objects.create(user=user)
|
142 |
+
# print('Group M Created')
|
143 |
+
|
144 |
+
|
145 |
+
# data = models.SalesTwoDigits.objects.filter(user=user,group=G)
|
146 |
+
# ser = serializers.SalesTwoDigitSerializer(data,many=True)
|
147 |
+
|
148 |
+
# return Response(ser.data)
|
149 |
+
|
150 |
+
# def post(self, request):
|
151 |
+
# name = request.data['customername']
|
152 |
+
# phoneno = request.data['phoneno']
|
153 |
+
# digits = request.data['digits']
|
154 |
+
# totalamount = request.data['totalamount']
|
155 |
+
# print(request.user)
|
156 |
+
# user = get_user_model().objects.get(username=request.user,is_plan=True,
|
157 |
+
# is_salesDigits=True)
|
158 |
+
|
159 |
+
# try:
|
160 |
+
# G = models.TwoDigitsGroup.objects.get(user=user, is_done=False)
|
161 |
+
# print('Group M Exists')
|
162 |
+
# except ObjectDoesNotExist:
|
163 |
+
# print('Group M Not Exits')
|
164 |
+
# G = models.TwoDigitsGroup.objects.create(user=user)
|
165 |
+
# print('Group M Created')
|
166 |
+
|
167 |
+
|
168 |
+
# # print(str(name) +'\n')
|
169 |
+
# # print(str(phoneno) + '\n')
|
170 |
+
# # print(digits)
|
171 |
+
# # print(int(totalamount))
|
172 |
+
|
173 |
+
# Sales = models.SalesTwoDigits.objects.create(customername=name,phoneno=phoneno,totalprice=totalamount,user=user,group=G)
|
174 |
+
# # Sales1 = models.SalesTwoDigits.objects.create(customername=name,phoneno=phoneno,totalprice=totalamount,user=user,group=G1)
|
175 |
+
|
176 |
+
# print('Sales Objects Created')
|
177 |
+
|
178 |
+
|
179 |
+
# ds = json.loads(digits)
|
180 |
+
# # print(p)
|
181 |
+
# for d in ds:
|
182 |
+
# print(d)
|
183 |
+
# d1 = models.TwoDigits.objects.create(number=d['digits'],amount=d['amount'],user=user,sales=Sales)
|
184 |
+
# print('D1 Create')
|
185 |
+
|
186 |
+
|
187 |
+
# print('Finished All')
|
188 |
+
|
189 |
+
# # product = models.Product.objects.get(id=b['name'], user=user)
|
190 |
+
# # product.qty = int(product.qty) - int(b['qty'])
|
191 |
+
# # product.save()
|
192 |
+
|
193 |
+
# # a = models.SoldProduct.objects.create(
|
194 |
+
# # name=product, price=b['price'], qty=b['qty'], sales=S)
|
195 |
+
# # print(a)
|
196 |
+
|
197 |
+
# # S.save()
|
198 |
+
|
199 |
+
# return Response(status=status.HTTP_201_CREATED)
|
app/apps.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.apps import AppConfig
|
2 |
+
|
3 |
+
|
4 |
+
class AppConfig(AppConfig):
|
5 |
+
default_auto_field = 'django.db.models.BigAutoField'
|
6 |
+
name = 'app'
|
app/haarcascade_frontalface_default.xml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app/migrations/0001_initial.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generated by Django 4.2.1 on 2023-05-09 17:18
|
2 |
+
|
3 |
+
import django.contrib.auth.models
|
4 |
+
import django.contrib.auth.validators
|
5 |
+
from django.db import migrations, models
|
6 |
+
import django.db.models.deletion
|
7 |
+
import django.utils.timezone
|
8 |
+
|
9 |
+
|
10 |
+
class Migration(migrations.Migration):
|
11 |
+
|
12 |
+
initial = True
|
13 |
+
|
14 |
+
dependencies = [
|
15 |
+
('auth', '0012_alter_user_first_name_max_length'),
|
16 |
+
]
|
17 |
+
|
18 |
+
operations = [
|
19 |
+
migrations.CreateModel(
|
20 |
+
name='PassportDetail',
|
21 |
+
fields=[
|
22 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
23 |
+
('size', models.CharField(choices=[('0.8, 0.8', '0.8 x 0.8 (မှတ်ပုံတင်ဆိုဒ်)'), ('1, 1', '1 x 1 (ကားလိုင်စင်ဆိုဒ်)'), ('1.1, 1.3', '1.1, 1.3 (ကျောင်းသား/ဝန်ထမ်းကဒ်)'), ('1.2, 1.4', '1.2 x 1.4 (လုပ်ငန်းသုံးလိုင်စင်ဆိုဒ်)'), ('1.25, 1.5', '1.25 x 1.5 (ဖောင်တင်ရန်၊ ဖုန်းလျှောက်ရန်)'), ('1.25, 1.6', '1.25, 1.6 (Visa လျှောက်ရန်)'), ('1.25, 1.65', '0.8 x 0.8 (Passport စာအုပ်ဆိုဒ်)'), ('1.5, 2', '0.8 x 0.8 (ဘွဲ့ဖောင်ဆိုဒ်)'), ('2,3', '2 x 3 (ထီးပေါက်လက်မှတ်ငွေထုတ်)')], max_length=255)),
|
24 |
+
('bw', models.BooleanField(default=False)),
|
25 |
+
('paper', models.CharField(choices=[('2480,3508', 'A4'), ('1200,1800', '4 x 6'), ('2550,3300', 'Letter'), ('2550,4200', 'Legal'), ('1748,2480', 'A5'), ('2079,2953', 'B5'), ('2175,3150', 'Executive'), ('2480,3900', 'Folio'), ('3300,5100', 'Ledger'), ('5100,6600', 'Poster')], max_length=255)),
|
26 |
+
('bgcolor', models.CharField(max_length=255, null=True)),
|
27 |
+
('is_done', models.BooleanField(default=False)),
|
28 |
+
],
|
29 |
+
),
|
30 |
+
migrations.CreateModel(
|
31 |
+
name='Images',
|
32 |
+
fields=[
|
33 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
34 |
+
('image', models.ImageField(null=True, upload_to='rawimg/%y/%mm/%dd')),
|
35 |
+
('img_qty', models.CharField(max_length=4)),
|
36 |
+
('ppd', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.passportdetail')),
|
37 |
+
],
|
38 |
+
),
|
39 |
+
migrations.CreateModel(
|
40 |
+
name='User',
|
41 |
+
fields=[
|
42 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
43 |
+
('password', models.CharField(max_length=128, verbose_name='password')),
|
44 |
+
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
45 |
+
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
46 |
+
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
47 |
+
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
|
48 |
+
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
49 |
+
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
50 |
+
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
51 |
+
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
52 |
+
('name', models.CharField(max_length=255)),
|
53 |
+
('phoneno', models.CharField(max_length=11, null=True)),
|
54 |
+
('profileimage', models.ImageField(null=True, upload_to='img/profile/%y/%mm/%dd')),
|
55 |
+
('email', models.EmailField(max_length=254, null=True, unique=True)),
|
56 |
+
('address', models.TextField(blank=True, null=True)),
|
57 |
+
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
|
58 |
+
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
|
59 |
+
],
|
60 |
+
options={
|
61 |
+
'verbose_name': 'user',
|
62 |
+
'verbose_name_plural': 'users',
|
63 |
+
'abstract': False,
|
64 |
+
},
|
65 |
+
managers=[
|
66 |
+
('objects', django.contrib.auth.models.UserManager()),
|
67 |
+
],
|
68 |
+
),
|
69 |
+
]
|
app/migrations/__init__.py
ADDED
File without changes
|
app/migrations/__pycache__/0001_initial.cpython-310.pyc
ADDED
Binary file (3.98 kB). View file
|
|
app/migrations/__pycache__/0002_remove_images_image_name_images_image_and_more.cpython-310.pyc
ADDED
Binary file (1.78 kB). View file
|
|
app/migrations/__pycache__/0003_remove_images_user.cpython-310.pyc
ADDED
Binary file (546 Bytes). View file
|
|
app/migrations/__pycache__/0004_images_img_qty.cpython-310.pyc
ADDED
Binary file (693 Bytes). View file
|
|
app/migrations/__pycache__/0005_passportdetail_is_done.cpython-310.pyc
ADDED
Binary file (593 Bytes). View file
|
|
app/migrations/__pycache__/0006_remove_passportdetail_user.cpython-310.pyc
ADDED
Binary file (538 Bytes). View file
|
|
app/migrations/__pycache__/0007_alter_passportdetail_bgcolor.cpython-310.pyc
ADDED
Binary file (626 Bytes). View file
|
|
app/migrations/__pycache__/0008_remove_passportdetail_images_images_ppd.cpython-310.pyc
ADDED
Binary file (874 Bytes). View file
|
|
app/migrations/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (152 Bytes). View file
|
|
app/models.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.db import models
|
2 |
+
|
3 |
+
# Create your models here.
|
4 |
+
from email.policy import default
|
5 |
+
from unittest.util import _MAX_LENGTH
|
6 |
+
from django.db import models
|
7 |
+
from django.contrib.auth.models import AbstractUser, Group
|
8 |
+
|
9 |
+
from django.core.files.base import ContentFile
|
10 |
+
# Create your models here.
|
11 |
+
|
12 |
+
class User(AbstractUser):
|
13 |
+
name = models.CharField(max_length=255, null=False)
|
14 |
+
phoneno = models.CharField(max_length=11, null=True, blank=False)
|
15 |
+
|
16 |
+
profileimage = models.ImageField(
|
17 |
+
upload_to="img/profile/%y/%mm/%dd", null=True)
|
18 |
+
email = models.EmailField(unique=True,null=True)
|
19 |
+
address = models.TextField(null=True,blank=True)
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
class PassportDetail(models.Model):
|
24 |
+
|
25 |
+
|
26 |
+
size_choose = [
|
27 |
+
('0.8, 0.8', '0.8 x 0.8 (မှတ်ပုံတင်ဆိုဒ်)'),
|
28 |
+
('1, 1', '1 x 1 (ကားလိုင်စင်ဆိုဒ်)'),
|
29 |
+
('1.1, 1.3', '1.1, 1.3 (ကျောင်းသား/ဝန်ထမ်းကဒ်)'),
|
30 |
+
('1.2, 1.4', '1.2 x 1.4 (လုပ်ငန်းသုံးလိုင်စင်ဆိုဒ်)'),
|
31 |
+
('1.25, 1.5', '1.25 x 1.5 (ဖောင်တင်ရန်၊ ဖုန်းလျှောက်ရန်)'),
|
32 |
+
('1.25, 1.6','1.25, 1.6 (Visa လျှောက်ရန်)'),
|
33 |
+
('1.25, 1.65', '0.8 x 0.8 (Passport စာအုပ်ဆိုဒ်)'),
|
34 |
+
('1.5, 2', '0.8 x 0.8 (ဘွဲ့ဖောင်ဆိုဒ်)'),
|
35 |
+
('2,3', '2 x 3 (ထီးပေါက်လက်မှတ်ငွေထုတ်)'),
|
36 |
+
]
|
37 |
+
|
38 |
+
paper_sizes = [
|
39 |
+
('2480,3508', 'A4'),
|
40 |
+
('1200,1800', '4 x 6'),
|
41 |
+
('2550,3300', 'Letter'),
|
42 |
+
('2550,4200', 'Legal'),
|
43 |
+
('1748,2480', 'A5'),
|
44 |
+
('2079,2953', 'B5'),
|
45 |
+
('2175,3150', 'Executive'),
|
46 |
+
('2480,3900', 'Folio'),
|
47 |
+
('3300,5100', 'Ledger'),
|
48 |
+
('5100,6600', 'Poster')
|
49 |
+
]
|
50 |
+
|
51 |
+
|
52 |
+
size = models.CharField(max_length=255) # Format "1.1,1.3"
|
53 |
+
bw = models.BooleanField(default=False)
|
54 |
+
paper = models.CharField(max_length=255) # Format "2480,3508"
|
55 |
+
bgcolor = models.CharField(max_length=255,null=True)
|
56 |
+
# images = models.ForeignKey(Images,on_delete=models.CASCADE,related_name='raw_images')
|
57 |
+
# user = models.ForeignKey(User,on_delete=models.CASCADE,related_name='passport_user')
|
58 |
+
is_done = models.BooleanField(default=False)
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
class Images(models.Model):
|
63 |
+
image = models.ImageField(upload_to="rawimg/%y/%mm/%dd", null= True)
|
64 |
+
img_qty = models.CharField(max_length=4)
|
65 |
+
ppd = models.ForeignKey(PassportDetail,on_delete=models.CASCADE)
|
app/r11.jpg
ADDED
app/serializers.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from rest_framework import serializers
|
2 |
+
from django.contrib.auth import get_user_model
|
3 |
+
from . import models
|
4 |
+
|
5 |
+
from django.core.exceptions import ObjectDoesNotExist
|
6 |
+
from django.core.exceptions import ValidationError
|
7 |
+
|
8 |
+
from django.utils import timezone
|
9 |
+
|
10 |
+
|
11 |
+
class CreateUserSerializer(serializers.ModelSerializer):
|
12 |
+
username = serializers.CharField()
|
13 |
+
password = serializers.CharField(write_only=True,
|
14 |
+
style={'input_type': 'password'})
|
15 |
+
|
16 |
+
class Meta:
|
17 |
+
model = get_user_model()
|
18 |
+
fields = ['name', 'username', 'email', 'phoneno', 'password','address']
|
19 |
+
write_only_fields = ('password')
|
20 |
+
|
21 |
+
def create(self, validated_data):
|
22 |
+
user = super(CreateUserSerializer, self).create(validated_data)
|
23 |
+
user.set_password(validated_data['password'])
|
24 |
+
user.save()
|
25 |
+
|
26 |
+
return user
|
app/tele.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import telegram
|
2 |
+
import asyncio
|
3 |
+
|
4 |
+
|
5 |
+
bot_token = '5499662958:AAEAoWy0khLJMf238ZwvvEoBV1FKfaVF6S0'
|
6 |
+
chat_id = '-618629809'
|
7 |
+
|
8 |
+
async def send(chat_id,document_path,bot_token):
|
9 |
+
|
10 |
+
# Create an instance of the bot
|
11 |
+
bot = telegram.Bot(token=bot_token)
|
12 |
+
a = open(document_path,'rb')
|
13 |
+
await bot.send_document(chat_id=chat_id,document=a)
|
14 |
+
|
15 |
+
|
16 |
+
class SendToTele():
|
17 |
+
def __init__(self,document_path,chat_id=chat_id,bot_token=bot_token):
|
18 |
+
print("Sending to tele")
|
19 |
+
asyncio.run(send(chat_id,document_path,bot_token))
|
20 |
+
print("Sended To Tele")
|
21 |
+
|
app/tests.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from django.test import TestCase
|
2 |
+
|
3 |
+
# Create your tests here.
|
app/urls.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.urls import path, include
|
2 |
+
|
3 |
+
# from app.models import SalesTwoDigits
|
4 |
+
from . import views
|
5 |
+
from . import apiview
|
6 |
+
from django.conf.urls.static import static
|
7 |
+
from django.conf import settings
|
8 |
+
from rest_framework.authtoken.views import obtain_auth_token
|
9 |
+
|
10 |
+
urlpatterns = [
|
11 |
+
path('api/auth/register',apiview.CreateUserApiView.as_view(),name='register'),
|
12 |
+
path('api/sendimage/', apiview.SendImage.as_view(), name='category'),
|
13 |
+
path('api/generateimage/', apiview.GenerateImage.as_view(), name='category'),
|
14 |
+
]
|
15 |
+
|
16 |
+
|
17 |
+
if settings.DEBUG:
|
18 |
+
urlpatterns += static(settings.MEDIA_URL,
|
19 |
+
document_root=settings.MEDIA_ROOT)
|
app/views.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from django.shortcuts import render
|
2 |
+
|
3 |
+
# Create your views here.
|
db.sqlite3
ADDED
Binary file (160 kB). View file
|
|
haarcascade_frontalface_default.xml
ADDED
The diff for this file is too large to render.
See raw diff
|
|
manage.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
"""Django's command-line utility for administrative tasks."""
|
3 |
+
import os
|
4 |
+
import sys
|
5 |
+
|
6 |
+
|
7 |
+
def main():
|
8 |
+
"""Run administrative tasks."""
|
9 |
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passportapi.settings')
|
10 |
+
try:
|
11 |
+
from django.core.management import execute_from_command_line
|
12 |
+
except ImportError as exc:
|
13 |
+
raise ImportError(
|
14 |
+
"Couldn't import Django. Are you sure it's installed and "
|
15 |
+
"available on your PYTHONPATH environment variable? Did you "
|
16 |
+
"forget to activate a virtual environment?"
|
17 |
+
) from exc
|
18 |
+
execute_from_command_line(sys.argv)
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == '__main__':
|
22 |
+
main()
|
media/rawimg/23/05m/09d/1.png
ADDED
media/rawimg/23/05m/09d/1_B8nghly.png
ADDED
media/rawimg/23/05m/09d/1_YCYv09S.png
ADDED
media/rawimg/23/05m/09d/1_drSLcYW.png
ADDED
media/rawimg/23/05m/09d/1_mE8I4vg.png
ADDED
media/rawimg/23/05m/09d/Screenshot_from_2023-03-27_16-31-00.png
ADDED
media/rawimg/23/05m/09d/Screenshot_from_2023-04-03_01-35-18.png
ADDED
passportapi/__init__.py
ADDED
File without changes
|