Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,7 +61,6 @@ detect = gr.Interface(
|
|
61 |
|
62 |
def upload_files(files):
|
63 |
if not os.path.exists(os.path.join(os.getcwd(), "temp")):
|
64 |
-
print("Folder Created!")
|
65 |
os.mkdir(os.path.join(os.getcwd(), "temp"))
|
66 |
for file in files:
|
67 |
shutil.move(file.name, os.path.join(os.getcwd(), "temp", file.name.split('\\')[-1]))
|
@@ -73,13 +72,12 @@ with gr.Blocks() as upload:
|
|
73 |
input = gr.Files(file_types=[".jpg", ".jpeg", ".png"], label="Upload images")
|
74 |
# input = gr.Image(type="filepath")
|
75 |
output = gr.Textbox()
|
76 |
-
upload_btn = gr.Button(
|
77 |
upload_btn.click(upload_files, inputs=[input], outputs=[input, output])
|
78 |
|
79 |
def load_image():
|
80 |
global i, imgs
|
81 |
images = os.listdir(os.path.join(os.getcwd(), "temp"))
|
82 |
-
print(len(images))
|
83 |
imgs = []
|
84 |
for image in images:
|
85 |
faces, id = extract_faces(detector, os.path.join(os.getcwd(), "temp", image))
|
@@ -111,11 +109,11 @@ with gr.Blocks() as annotate:
|
|
111 |
output = gr.Image(type="pil", label="Image")
|
112 |
input = gr.Textbox(label = "Enter Label")
|
113 |
with gr.Row():
|
114 |
-
next_btn = gr.Button(
|
115 |
next_btn.click(load_image, inputs=[], outputs=[output, input])
|
116 |
-
save_btn = gr.Button(
|
117 |
save_btn.click(save_img, inputs=[input], outputs=[output, input])
|
118 |
-
clear_btn = gr.Button(
|
119 |
clear_btn.click(clear, inputs=[], outputs=[output, input])
|
120 |
|
121 |
tabbed_interface = gr.TabbedInterface(
|
|
|
61 |
|
62 |
def upload_files(files):
|
63 |
if not os.path.exists(os.path.join(os.getcwd(), "temp")):
|
|
|
64 |
os.mkdir(os.path.join(os.getcwd(), "temp"))
|
65 |
for file in files:
|
66 |
shutil.move(file.name, os.path.join(os.getcwd(), "temp", file.name.split('\\')[-1]))
|
|
|
72 |
input = gr.Files(file_types=[".jpg", ".jpeg", ".png"], label="Upload images")
|
73 |
# input = gr.Image(type="filepath")
|
74 |
output = gr.Textbox()
|
75 |
+
upload_btn = gr.Button(value="Upload")
|
76 |
upload_btn.click(upload_files, inputs=[input], outputs=[input, output])
|
77 |
|
78 |
def load_image():
|
79 |
global i, imgs
|
80 |
images = os.listdir(os.path.join(os.getcwd(), "temp"))
|
|
|
81 |
imgs = []
|
82 |
for image in images:
|
83 |
faces, id = extract_faces(detector, os.path.join(os.getcwd(), "temp", image))
|
|
|
109 |
output = gr.Image(type="pil", label="Image")
|
110 |
input = gr.Textbox(label = "Enter Label")
|
111 |
with gr.Row():
|
112 |
+
next_btn = gr.Button(value="Next")
|
113 |
next_btn.click(load_image, inputs=[], outputs=[output, input])
|
114 |
+
save_btn = gr.Button(value="Save")
|
115 |
save_btn.click(save_img, inputs=[input], outputs=[output, input])
|
116 |
+
clear_btn = gr.Button(value="Clear")
|
117 |
clear_btn.click(clear, inputs=[], outputs=[output, input])
|
118 |
|
119 |
tabbed_interface = gr.TabbedInterface(
|