Spaces:
Build error
Build error
Ubuntu commited on
Commit ·
ce6d9ab
1
Parent(s): 7eaf50e
- .ipynb_checkpoints/app-checkpoint.py +15 -4
- app.py +15 -4
- requirements.txt +2 -1
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -4,12 +4,23 @@ import cv2
|
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
-
def video_identity(
|
|
|
|
|
|
|
| 8 |
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
demo = gr.Interface(video_identity,
|
| 12 |
-
gr.Video(),
|
| 13 |
-
gr.
|
| 14 |
cache_examples=True)
|
| 15 |
demo.launch(debug=True)
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
+
def video_identity(filepath):
|
| 8 |
+
vid = EncodedVideo.from_path(filepath)
|
| 9 |
+
while (True):
|
| 10 |
|
| 11 |
+
success, frame = capture.read()
|
| 12 |
|
| 13 |
+
if success:
|
| 14 |
+
cv2.imwrite(f'train/frame_{frameNr}.jpg', frame)
|
| 15 |
+
|
| 16 |
+
else:
|
| 17 |
+
break
|
| 18 |
+
|
| 19 |
+
frameNr = frameNr+10
|
| 20 |
+
img=cv2.imread('train/frame_0')
|
| 21 |
+
return img
|
| 22 |
demo = gr.Interface(video_identity,
|
| 23 |
+
gr.inputs.Video(source_upload),
|
| 24 |
+
gr.inputs.Image(),
|
| 25 |
cache_examples=True)
|
| 26 |
demo.launch(debug=True)
|
app.py
CHANGED
|
@@ -4,12 +4,23 @@ import cv2
|
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
-
def video_identity(
|
|
|
|
|
|
|
| 8 |
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
demo = gr.Interface(video_identity,
|
| 12 |
-
gr.Video(),
|
| 13 |
-
gr.
|
| 14 |
cache_examples=True)
|
| 15 |
demo.launch(debug=True)
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
+
def video_identity(filepath):
|
| 8 |
+
vid = EncodedVideo.from_path(filepath)
|
| 9 |
+
while (True):
|
| 10 |
|
| 11 |
+
success, frame = capture.read()
|
| 12 |
|
| 13 |
+
if success:
|
| 14 |
+
cv2.imwrite(f'train/frame_{frameNr}.jpg', frame)
|
| 15 |
+
|
| 16 |
+
else:
|
| 17 |
+
break
|
| 18 |
+
|
| 19 |
+
frameNr = frameNr+10
|
| 20 |
+
img=cv2.imread('train/frame_0')
|
| 21 |
+
return img
|
| 22 |
demo = gr.Interface(video_identity,
|
| 23 |
+
gr.inputs.Video(source_upload),
|
| 24 |
+
gr.inputs.Image(),
|
| 25 |
cache_examples=True)
|
| 26 |
demo.launch(debug=True)
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
opencv-python
|
|
|
|
|
|
| 1 |
+
opencv-python
|
| 2 |
+
encoded-video
|