change cuda
Browse files
app.py
CHANGED
|
@@ -1005,8 +1005,11 @@ def handle_upload(files, chat_state, img_list):
|
|
| 1005 |
|
| 1006 |
# return gr.update(value=[]), gr.update(value=None, interactive=True), gr.update(placeholder='Please upload your image first', interactive=False),gr.update(value="Upload & Start Chat", interactive=True), gr.update(interactive=False), chat_state, img_list
|
| 1007 |
# chatbot, image, text_input, upload_button, submit_button, chat_state, img_list
|
| 1008 |
-
|
| 1009 |
@spaces.GPU
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1010 |
def upload_img(chatbot,t1c_ax_file, t1_file, t2_file, fla_file, text_input, chat_state, model_type):
|
| 1011 |
# 允许5个文件输入为None,自动跳过为None的对象
|
| 1012 |
# modalities=['t1c ax','t1 ax','t2 ax','t2f ax','t1c sag']
|
|
@@ -1208,7 +1211,9 @@ def upload_img(chatbot,t1c_ax_file, t1_file, t2_file, fla_file, text_input, chat
|
|
| 1208 |
|
| 1209 |
img_list = []
|
| 1210 |
llm_message = chat.upload_img(files, chat_state, img_list)
|
| 1211 |
-
|
|
|
|
|
|
|
| 1212 |
return chatbot, chat_state, instruction, LR_image_list, HR_image_list, modalities, gr.update(interactive=False),gr.update(interactive=False)
|
| 1213 |
|
| 1214 |
# t1c_ax_file, t1_file, t2_file, fla_file, t1c_file, text_input, chat_state, model_type
|
|
|
|
| 1005 |
|
| 1006 |
# return gr.update(value=[]), gr.update(value=None, interactive=True), gr.update(placeholder='Please upload your image first', interactive=False),gr.update(value="Upload & Start Chat", interactive=True), gr.update(interactive=False), chat_state, img_list
|
| 1007 |
# chatbot, image, text_input, upload_button, submit_button, chat_state, img_list
|
|
|
|
| 1008 |
@spaces.GPU
|
| 1009 |
+
def encode_img(img_list, modalities):
|
| 1010 |
+
instruction, LR_image_list, HR_image_list, modalities = chat.encode_img(img_list, modalities)
|
| 1011 |
+
return instruction, LR_image_list, HR_image_list, modalities
|
| 1012 |
+
|
| 1013 |
def upload_img(chatbot,t1c_ax_file, t1_file, t2_file, fla_file, text_input, chat_state, model_type):
|
| 1014 |
# 允许5个文件输入为None,自动跳过为None的对象
|
| 1015 |
# modalities=['t1c ax','t1 ax','t2 ax','t2f ax','t1c sag']
|
|
|
|
| 1211 |
|
| 1212 |
img_list = []
|
| 1213 |
llm_message = chat.upload_img(files, chat_state, img_list)
|
| 1214 |
+
|
| 1215 |
+
instruction, LR_image_list, HR_image_list, modalities = encode_img(img_list, modalities)
|
| 1216 |
+
# instruction, LR_image_list, HR_image_list, modalities = chat.encode_img(img_list, modalities)
|
| 1217 |
return chatbot, chat_state, instruction, LR_image_list, HR_image_list, modalities, gr.update(interactive=False),gr.update(interactive=False)
|
| 1218 |
|
| 1219 |
# t1c_ax_file, t1_file, t2_file, fla_file, t1c_file, text_input, chat_state, model_type
|