Spaces:
Build error
Build error
Ubuntu
commited on
Commit
·
e28fcd2
1
Parent(s):
9381582
- .ipynb_checkpoints/app-checkpoint.py +10 -6
- app.py +10 -6
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -7,12 +7,15 @@ import numpy as np
|
|
| 7 |
|
| 8 |
def video_identity(video,user_name,class_name,trainortest,ready):
|
| 9 |
if ready=='yes':
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
else:
|
| 12 |
capture = cv2.VideoCapture(video)
|
| 13 |
|
| 14 |
-
user_d=str(trainortest)+str(user_name)
|
| 15 |
-
class_d=str(trainortest)+str(user_name)+'/'+str(class_name)
|
| 16 |
if not os.path.exists(user_d):
|
| 17 |
os.makedirs(user_d)
|
| 18 |
if not os.path.exists(class_d):
|
|
@@ -32,14 +35,15 @@ def video_identity(video,user_name,class_name,trainortest,ready):
|
|
| 32 |
|
| 33 |
img=cv2.imread(class_d+'/frame_0.jpg')
|
| 34 |
|
| 35 |
-
return img, class_d
|
| 36 |
demo = gr.Interface(video_identity,
|
| 37 |
inputs=[gr.Video(source='upload'),
|
| 38 |
gr.Text(),
|
| 39 |
gr.Text(),
|
| 40 |
-
gr.Text(label='type train or test'),
|
| 41 |
-
gr.Text(label='type yes or no')],
|
| 42 |
outputs=[gr.Image(),
|
|
|
|
| 43 |
gr.Text()],
|
| 44 |
cache_examples=True)
|
| 45 |
demo.launch(debug=True)
|
|
|
|
| 7 |
|
| 8 |
def video_identity(video,user_name,class_name,trainortest,ready):
|
| 9 |
if ready=='yes':
|
| 10 |
+
|
| 11 |
+
img=cv2.imread('train/book/frame_0.jpg')
|
| 12 |
+
img=cv2.imread('train/wallet/frame_0.jpg')
|
| 13 |
+
return img, class_name
|
| 14 |
else:
|
| 15 |
capture = cv2.VideoCapture(video)
|
| 16 |
|
| 17 |
+
user_d=str(trainortest)+'/'+str(user_name)
|
| 18 |
+
class_d=str(trainortest)+'/'+str(user_name)+'/'+str(class_name)
|
| 19 |
if not os.path.exists(user_d):
|
| 20 |
os.makedirs(user_d)
|
| 21 |
if not os.path.exists(class_d):
|
|
|
|
| 35 |
|
| 36 |
img=cv2.imread(class_d+'/frame_0.jpg')
|
| 37 |
|
| 38 |
+
return img, img, class_d
|
| 39 |
demo = gr.Interface(video_identity,
|
| 40 |
inputs=[gr.Video(source='upload'),
|
| 41 |
gr.Text(),
|
| 42 |
gr.Text(),
|
| 43 |
+
gr.Text(label='Which set is this? (type train or test)'),
|
| 44 |
+
gr.Text(label='Are you ready? (type yes or no)')],
|
| 45 |
outputs=[gr.Image(),
|
| 46 |
+
gr.Image(),
|
| 47 |
gr.Text()],
|
| 48 |
cache_examples=True)
|
| 49 |
demo.launch(debug=True)
|
app.py
CHANGED
|
@@ -7,12 +7,15 @@ import numpy as np
|
|
| 7 |
|
| 8 |
def video_identity(video,user_name,class_name,trainortest,ready):
|
| 9 |
if ready=='yes':
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
else:
|
| 12 |
capture = cv2.VideoCapture(video)
|
| 13 |
|
| 14 |
-
user_d=str(trainortest)+str(user_name)
|
| 15 |
-
class_d=str(trainortest)+str(user_name)+'/'+str(class_name)
|
| 16 |
if not os.path.exists(user_d):
|
| 17 |
os.makedirs(user_d)
|
| 18 |
if not os.path.exists(class_d):
|
|
@@ -32,14 +35,15 @@ def video_identity(video,user_name,class_name,trainortest,ready):
|
|
| 32 |
|
| 33 |
img=cv2.imread(class_d+'/frame_0.jpg')
|
| 34 |
|
| 35 |
-
return img, class_d
|
| 36 |
demo = gr.Interface(video_identity,
|
| 37 |
inputs=[gr.Video(source='upload'),
|
| 38 |
gr.Text(),
|
| 39 |
gr.Text(),
|
| 40 |
-
gr.Text(label='type train or test'),
|
| 41 |
-
gr.Text(label='type yes or no')],
|
| 42 |
outputs=[gr.Image(),
|
|
|
|
| 43 |
gr.Text()],
|
| 44 |
cache_examples=True)
|
| 45 |
demo.launch(debug=True)
|
|
|
|
| 7 |
|
| 8 |
def video_identity(video,user_name,class_name,trainortest,ready):
|
| 9 |
if ready=='yes':
|
| 10 |
+
|
| 11 |
+
img=cv2.imread('train/book/frame_0.jpg')
|
| 12 |
+
img=cv2.imread('train/wallet/frame_0.jpg')
|
| 13 |
+
return img, class_name
|
| 14 |
else:
|
| 15 |
capture = cv2.VideoCapture(video)
|
| 16 |
|
| 17 |
+
user_d=str(trainortest)+'/'+str(user_name)
|
| 18 |
+
class_d=str(trainortest)+'/'+str(user_name)+'/'+str(class_name)
|
| 19 |
if not os.path.exists(user_d):
|
| 20 |
os.makedirs(user_d)
|
| 21 |
if not os.path.exists(class_d):
|
|
|
|
| 35 |
|
| 36 |
img=cv2.imread(class_d+'/frame_0.jpg')
|
| 37 |
|
| 38 |
+
return img, img, class_d
|
| 39 |
demo = gr.Interface(video_identity,
|
| 40 |
inputs=[gr.Video(source='upload'),
|
| 41 |
gr.Text(),
|
| 42 |
gr.Text(),
|
| 43 |
+
gr.Text(label='Which set is this? (type train or test)'),
|
| 44 |
+
gr.Text(label='Are you ready? (type yes or no)')],
|
| 45 |
outputs=[gr.Image(),
|
| 46 |
+
gr.Image(),
|
| 47 |
gr.Text()],
|
| 48 |
cache_examples=True)
|
| 49 |
demo.launch(debug=True)
|