Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,15 +67,15 @@ def main():
|
|
| 67 |
|
| 68 |
uploaded_file = st.file_uploader("π Upload video: ", ['.mp4'])
|
| 69 |
|
| 70 |
-
if uploaded_file is not None:
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
else:
|
| 78 |
-
|
| 79 |
|
| 80 |
# if play_video:
|
| 81 |
# video_bytes = uploaded_file.read()
|
|
@@ -93,8 +93,8 @@ def main():
|
|
| 93 |
|
| 94 |
if button:
|
| 95 |
# try:
|
| 96 |
-
tfile = tempfile.NamedTemporaryFile(delete=False)
|
| 97 |
-
tfile.write(uploaded_file.read())
|
| 98 |
|
| 99 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 100 |
val_embeddings = []
|
|
@@ -103,7 +103,7 @@ def main():
|
|
| 103 |
text = f'Question: {question}? Answer:'
|
| 104 |
|
| 105 |
# read video -> get_ans
|
| 106 |
-
video = read_video(
|
| 107 |
|
| 108 |
if len(video) > 0:
|
| 109 |
i = image_grid(video, 2, 2)
|
|
|
|
| 67 |
|
| 68 |
uploaded_file = st.file_uploader("π Upload video: ", ['.mp4'])
|
| 69 |
|
| 70 |
+
# if uploaded_file is not None:
|
| 71 |
+
# st.write('success')
|
| 72 |
+
# tfile = tempfile.NamedTemporaryFile(delete=False)
|
| 73 |
+
# tfile.write(uploaded_file.read())
|
| 74 |
+
# st.write(tfile, tfile.name)
|
| 75 |
+
# cap = cv2.VideoCapture(tfile.name)
|
| 76 |
+
# st.write(cap)
|
| 77 |
+
# else:
|
| 78 |
+
# st.write('no')
|
| 79 |
|
| 80 |
# if play_video:
|
| 81 |
# video_bytes = uploaded_file.read()
|
|
|
|
| 93 |
|
| 94 |
if button:
|
| 95 |
# try:
|
| 96 |
+
# tfile = tempfile.NamedTemporaryFile(delete=False)
|
| 97 |
+
# tfile.write(uploaded_file.read())
|
| 98 |
|
| 99 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 100 |
val_embeddings = []
|
|
|
|
| 103 |
text = f'Question: {question}? Answer:'
|
| 104 |
|
| 105 |
# read video -> get_ans
|
| 106 |
+
video = read_video(uploaded_file.name, transform=None, frames_num=4)
|
| 107 |
|
| 108 |
if len(video) > 0:
|
| 109 |
i = image_grid(video, 2, 2)
|