Spaces:
Sleeping
Sleeping
Reuben Tan
commited on
Commit
·
eed8ced
1
Parent(s):
0eacc93
resolve missing img error
Browse files
app.py
CHANGED
|
@@ -111,30 +111,18 @@ def gradio_reset(chat_state, img_list):
|
|
| 111 |
img_list = []
|
| 112 |
return None, gr.update(value=None, interactive=True), 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
|
| 113 |
|
| 114 |
-
def upload_imgorvideo(gr_video,
|
| 115 |
if args.model_type == 'vicuna':
|
| 116 |
chat_state = default_conversation.copy()
|
| 117 |
else:
|
| 118 |
chat_state = conv_llava_llama_2.copy()
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
llm_message = chat.upload_img(gr_img, chat_state, img_list)
|
| 127 |
-
return gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=True, placeholder='Type and press Enter'), gr.update(value="Start Chatting", interactive=False), chat_state, img_list,chatbot
|
| 128 |
-
elif gr_video is not None and gr_img is None:
|
| 129 |
-
print(gr_video)
|
| 130 |
-
chatbot = chatbot + [((gr_video,), None)]
|
| 131 |
-
chat_state.system = "You are able to understand the visual content that the user provides. Follow the instructions carefully and explain your answers in detail."
|
| 132 |
-
img_list = []
|
| 133 |
-
llm_message = chat.upload_video_without_audio(gr_video, chat_state, img_list)
|
| 134 |
-
return gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=True, placeholder='Type and press Enter'), gr.update(value="Start Chatting", interactive=False), chat_state, img_list,chatbot
|
| 135 |
-
else:
|
| 136 |
-
# img_list = []
|
| 137 |
-
return gr.update(interactive=False), gr.update(interactive=False, placeholder='Currently, only one input is supported'), gr.update(value="Currently, only one input is supported", interactive=False), chat_state, None,chatbot
|
| 138 |
|
| 139 |
def gradio_ask(user_message, chatbot, chat_state):
|
| 140 |
if len(user_message) == 0:
|
|
|
|
| 111 |
img_list = []
|
| 112 |
return None, gr.update(value=None, interactive=True), 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
|
| 113 |
|
| 114 |
+
def upload_imgorvideo(gr_video, text_input, chat_state,chatbot):
|
| 115 |
if args.model_type == 'vicuna':
|
| 116 |
chat_state = default_conversation.copy()
|
| 117 |
else:
|
| 118 |
chat_state = conv_llava_llama_2.copy()
|
| 119 |
+
|
| 120 |
+
print(gr_video)
|
| 121 |
+
chatbot = chatbot + [((gr_video,), None)]
|
| 122 |
+
chat_state.system = "You are able to understand the visual content that the user provides. Follow the instructions carefully and explain your answers in detail."
|
| 123 |
+
img_list = []
|
| 124 |
+
llm_message = chat.upload_video_without_audio(gr_video, chat_state, img_list)
|
| 125 |
+
return gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=True, placeholder='Type and press Enter'), gr.update(value="Start Chatting", interactive=False), chat_state, img_list,chatbot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
def gradio_ask(user_message, chatbot, chat_state):
|
| 128 |
if len(user_message) == 0:
|