Upload folder using huggingface_hub
Browse files- __pycache__/Infer.cpython-310.pyc +0 -0
- __pycache__/Infer.cpython-312.pyc +0 -0
- __pycache__/VideoLoader.cpython-310.pyc +0 -0
- app.py +70 -41
- model/__pycache__/adapter.cpython-310.pyc +0 -0
- model/__pycache__/deberta_moe.cpython-310.pyc +0 -0
- model/__pycache__/deberta_moe.cpython-312.pyc +0 -0
- model/__pycache__/evl.cpython-310.pyc +0 -0
- model/__pycache__/moe.cpython-310.pyc +0 -0
- requirements.txt +1 -2
__pycache__/Infer.cpython-310.pyc
ADDED
Binary file (3.86 kB). View file
|
|
__pycache__/Infer.cpython-312.pyc
ADDED
Binary file (7.07 kB). View file
|
|
__pycache__/VideoLoader.cpython-310.pyc
ADDED
Binary file (4.1 kB). View file
|
|
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import shutil
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
-
from fastapi import FastAPI
|
5 |
import os
|
6 |
import tempfile
|
7 |
from Infer import Infer
|
@@ -37,9 +36,9 @@ def generate(video, textbox_in, candbox_in):
|
|
37 |
video = video if video else "none"
|
38 |
|
39 |
text_en_out = handler.generate(textbox_in, eval(candbox_in), video)
|
40 |
-
print(text_en_out)
|
41 |
textbox_out = text_en_out
|
42 |
#torch.cuda.empty_cache()
|
|
|
43 |
return textbox_out
|
44 |
|
45 |
|
@@ -52,9 +51,10 @@ if not os.path.exists("temp"):
|
|
52 |
#print(torch.cuda.memory_allocated())
|
53 |
#print(torch.cuda.max_memory_allocated())
|
54 |
|
|
|
|
|
55 |
question_box = gr.Textbox(
|
56 |
-
|
57 |
-
)
|
58 |
|
59 |
candidates_box = gr.Textbox(
|
60 |
show_label=False, placeholder="Enter a list of options", container=False
|
@@ -66,45 +66,74 @@ with gr.Blocks(title='T-MoENet', theme=gr.themes.Default(), css=block_css) as de
|
|
66 |
state_ = gr.State()
|
67 |
first_run = gr.State()
|
68 |
images_tensor = gr.State()
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
with gr.Column(scale=3):
|
72 |
-
video = gr.Video(label="Input Video")
|
73 |
-
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
74 |
-
print(cur_dir)
|
75 |
gr.Examples(
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
],
|
82 |
-
[
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
demo.launch(share=True)
|
|
|
1 |
import shutil
|
2 |
import gradio as gr
|
3 |
import torch
|
|
|
4 |
import os
|
5 |
import tempfile
|
6 |
from Infer import Infer
|
|
|
36 |
video = video if video else "none"
|
37 |
|
38 |
text_en_out = handler.generate(textbox_in, eval(candbox_in), video)
|
|
|
39 |
textbox_out = text_en_out
|
40 |
#torch.cuda.empty_cache()
|
41 |
+
print(textbox_out)
|
42 |
return textbox_out
|
43 |
|
44 |
|
|
|
51 |
#print(torch.cuda.memory_allocated())
|
52 |
#print(torch.cuda.max_memory_allocated())
|
53 |
|
54 |
+
|
55 |
+
video = gr.Video(label="Input Video")
|
56 |
question_box = gr.Textbox(
|
57 |
+
show_label=False, placeholder="Enter question", container=False)
|
|
|
58 |
|
59 |
candidates_box = gr.Textbox(
|
60 |
show_label=False, placeholder="Enter a list of options", container=False
|
|
|
66 |
state_ = gr.State()
|
67 |
first_run = gr.State()
|
68 |
images_tensor = gr.State()
|
69 |
+
cur_dir = os.path.dirname(os.path.abspath(__file__))
|
70 |
+
|
71 |
+
with gr.Column():
|
72 |
+
with gr.Column(scale=3):
|
73 |
+
gr.Interface(
|
74 |
+
generate,
|
75 |
+
[video, question_box, candidates_box],
|
76 |
+
["text"]
|
77 |
+
)
|
78 |
with gr.Column(scale=3):
|
|
|
|
|
|
|
79 |
gr.Examples(
|
80 |
+
examples=[
|
81 |
+
[
|
82 |
+
cur_dir + "/videos/3249402410.mp4",
|
83 |
+
"What did the lady in black on the left do after she finished spreading the sauce on her pizza?",
|
84 |
+
"['slice the pizza', 'cut the meat', 'point', 'put cheese', 'put on plate']"
|
85 |
+
],
|
86 |
+
[
|
87 |
+
cur_dir + "/videos/4882821564.mp4",
|
88 |
+
"Why did the boy clap his hands when he ran to the christmas tree?",
|
89 |
+
"['adjust the tree', 'get away the dust', 'dancing', 'pressed a button to activate', 'presents']"
|
90 |
+
],
|
91 |
+
[
|
92 |
+
cur_dir + "/videos/6233408665.mp4",
|
93 |
+
"What did the people on the sofa do after the lady in pink finished singing?",
|
94 |
+
"['sitting', 'give it to the girl', 'take music sheet', 'clap', 'walk in circles']"
|
95 |
+
],
|
96 |
],
|
97 |
+
inputs=[video, question_box, candidates_box]
|
98 |
+
)
|
99 |
+
|
100 |
+
# with gr.Row():
|
101 |
+
# with gr.Column(scale=3):
|
102 |
+
# video = gr.Video(label="Input Video")
|
103 |
+
# cur_dir = os.path.dirname(os.path.abspath(__file__))
|
104 |
+
# print(cur_dir)
|
105 |
+
# gr.Examples(
|
106 |
+
# examples=[
|
107 |
+
# [
|
108 |
+
# cur_dir + "/videos/3249402410.mp4",
|
109 |
+
# "What did the lady in black on the left do after she finished spreading the sauce on her pizza?",
|
110 |
+
# "['slice the pizza', 'cut the meat', 'point', 'put cheese', 'put on plate']"
|
111 |
+
# ],
|
112 |
+
# [
|
113 |
+
# cur_dir + "/videos/4882821564.mp4",
|
114 |
+
# "Why did the boy clap his hands when he ran to the christmas tree?",
|
115 |
+
# "['adjust the tree', 'get away the dust', 'dancing', 'pressed a button to activate', 'presents']"
|
116 |
+
# ],
|
117 |
+
# [
|
118 |
+
# cur_dir + "/videos/6233408665.mp4",
|
119 |
+
# "What did the people on the sofa do after the lady in pink finished singing?",
|
120 |
+
# "['sitting', 'give it to the girl', 'take music sheet', 'clap', 'walk in circles']"
|
121 |
+
# ],
|
122 |
+
# ],
|
123 |
+
# inputs=[video, question_box, candidates_box],
|
124 |
+
# )
|
125 |
+
|
126 |
+
# with gr.Column(scale=3):
|
127 |
+
|
128 |
+
# with gr.Row():
|
129 |
+
# with gr.Column(scale=4):
|
130 |
+
# question_box.render()
|
131 |
+
# with gr.Column(scale=4):
|
132 |
+
# candidates_box.render()
|
133 |
+
# with gr.Column(scale=1, min_width=50):
|
134 |
+
# submit_btn = gr.Button(
|
135 |
+
# value="Send", variant="primary", interactive=True
|
136 |
+
# )
|
137 |
+
#submit_btn.click(generate, [video, question_box, candidates_box], [chatbot])
|
138 |
|
139 |
demo.launch(share=True)
|
model/__pycache__/adapter.cpython-310.pyc
ADDED
Binary file (2.49 kB). View file
|
|
model/__pycache__/deberta_moe.cpython-310.pyc
ADDED
Binary file (41 kB). View file
|
|
model/__pycache__/deberta_moe.cpython-312.pyc
ADDED
Binary file (71.7 kB). View file
|
|
model/__pycache__/evl.cpython-310.pyc
ADDED
Binary file (10.5 kB). View file
|
|
model/__pycache__/moe.cpython-310.pyc
ADDED
Binary file (15.1 kB). View file
|
|
requirements.txt
CHANGED
@@ -42,7 +42,6 @@ matplotlib==3.7.5
|
|
42 |
mdurl==0.1.2
|
43 |
mpmath==1.3.0
|
44 |
networkx==3.1
|
45 |
-
numpy==1.24.4
|
46 |
nvidia-cublas-cu11==11.10.3.66
|
47 |
nvidia-cuda-cupti-cu11==11.7.101
|
48 |
nvidia-cuda-nvrtc-cu11==11.7.99
|
@@ -57,7 +56,7 @@ nvidia-nvtx-cu11==11.7.91
|
|
57 |
opencv-python==4.10.0.84
|
58 |
orjson==3.10.6
|
59 |
packaging==24.1
|
60 |
-
pandas
|
61 |
pillow==10.4.0
|
62 |
pkgutil_resolve_name==1.3.10
|
63 |
pydantic==2.8.2
|
|
|
42 |
mdurl==0.1.2
|
43 |
mpmath==1.3.0
|
44 |
networkx==3.1
|
|
|
45 |
nvidia-cublas-cu11==11.10.3.66
|
46 |
nvidia-cuda-cupti-cu11==11.7.101
|
47 |
nvidia-cuda-nvrtc-cu11==11.7.99
|
|
|
56 |
opencv-python==4.10.0.84
|
57 |
orjson==3.10.6
|
58 |
packaging==24.1
|
59 |
+
pandas
|
60 |
pillow==10.4.0
|
61 |
pkgutil_resolve_name==1.3.10
|
62 |
pydantic==2.8.2
|