Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ import cv2
|
|
9 |
# import copy
|
10 |
import torch
|
11 |
|
12 |
-
|
13 |
import numpy as np
|
14 |
|
15 |
from llava import conversation as conversation_lib
|
@@ -155,7 +155,7 @@ def add_message(history, message):
|
|
155 |
return history, gr.MultimodalTextbox(value=None, interactive=False)
|
156 |
|
157 |
|
158 |
-
|
159 |
def bot(history):
|
160 |
text = history[-1][0]
|
161 |
images_this_term = []
|
@@ -437,10 +437,8 @@ if __name__ == "__main__":
|
|
437 |
args = argparser.parse_args()
|
438 |
model_path = args.model_path
|
439 |
filt_invalid = "cut"
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
our_chatbot = None
|
444 |
-
# import pdb;pdb.set_trace()
|
445 |
-
# try:
|
446 |
demo.launch()
|
|
|
9 |
# import copy
|
10 |
import torch
|
11 |
|
12 |
+
import spaces
|
13 |
import numpy as np
|
14 |
|
15 |
from llava import conversation as conversation_lib
|
|
|
155 |
return history, gr.MultimodalTextbox(value=None, interactive=False)
|
156 |
|
157 |
|
158 |
+
@spaces.GPU
|
159 |
def bot(history):
|
160 |
text = history[-1][0]
|
161 |
images_this_term = []
|
|
|
437 |
args = argparser.parse_args()
|
438 |
model_path = args.model_path
|
439 |
filt_invalid = "cut"
|
440 |
+
model_name = get_model_name_from_path(args.model_path)
|
441 |
+
tokenizer, model, image_processor, context_len = load_pretrained_model(args.model_path, args.model_base, model_name, args.load_8bit, args.load_4bit)
|
442 |
+
model=model.to(torch.device('cuda'))
|
443 |
our_chatbot = None
|
|
|
|
|
444 |
demo.launch()
|