Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
try:
|
3 |
token =os.environ['HF_TOKEN']
|
4 |
except:
|
@@ -203,7 +204,7 @@ def gradio_reset(chat_state, img_list):
|
|
203 |
img_list = None
|
204 |
return None, gr.update(value=None, interactive=True), gr.update(placeholder='Please upload your video first', interactive=False),gr.update(value="Upload & Start Chat", interactive=True), chat_state, img_list
|
205 |
|
206 |
-
|
207 |
def upload_img( gr_video, num_segments, hd_num, padding):
|
208 |
img_list = []
|
209 |
if gr_video is None:
|
@@ -225,7 +226,7 @@ def gradio_ask(user_message, chatbot):
|
|
225 |
chatbot = chatbot + [[user_message, None]]
|
226 |
return '', chatbot
|
227 |
|
228 |
-
|
229 |
def gradio_answer(chatbot, sys_prompt, user_prompt, video_tensor, chat_state, num_beams, temperature, do_sample=False):
|
230 |
response, chat_state = model.chat(tokenizer,
|
231 |
sys_prompt,
|
|
|
1 |
import os
|
2 |
+
import spaces
|
3 |
try:
|
4 |
token =os.environ['HF_TOKEN']
|
5 |
except:
|
|
|
204 |
img_list = None
|
205 |
return None, gr.update(value=None, interactive=True), gr.update(placeholder='Please upload your video first', interactive=False),gr.update(value="Upload & Start Chat", interactive=True), chat_state, img_list
|
206 |
|
207 |
+
@spaces.GPU
|
208 |
def upload_img( gr_video, num_segments, hd_num, padding):
|
209 |
img_list = []
|
210 |
if gr_video is None:
|
|
|
226 |
chatbot = chatbot + [[user_message, None]]
|
227 |
return '', chatbot
|
228 |
|
229 |
+
@spaces.GPU
|
230 |
def gradio_answer(chatbot, sys_prompt, user_prompt, video_tensor, chat_state, num_beams, temperature, do_sample=False):
|
231 |
response, chat_state = model.chat(tokenizer,
|
232 |
sys_prompt,
|