Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/lmms-lab/LLaVA-NeXT-Interleave-Demo
Browse files- app.py +5 -7
- requirements.txt +3 -3
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()
|
requirements.txt
CHANGED
|
@@ -4,6 +4,7 @@ opencv-python
|
|
| 4 |
open_clip_torch
|
| 5 |
fastapi
|
| 6 |
gradio==4.35.0
|
|
|
|
| 7 |
markdown2[all]
|
| 8 |
numpy
|
| 9 |
requests
|
|
@@ -22,8 +23,7 @@ scikit-learn==1.2.2
|
|
| 22 |
sentencepiece~=0.1.99
|
| 23 |
einops==0.6.1
|
| 24 |
einops-exts==0.0.4
|
| 25 |
-
|
| 26 |
-
pydantic==1.10.8
|
| 27 |
timm
|
| 28 |
hf_transfer
|
| 29 |
decord
|
|
@@ -31,5 +31,5 @@ datasets==2.16.1
|
|
| 31 |
tyro
|
| 32 |
scipy
|
| 33 |
rouge
|
| 34 |
-
urllib3
|
| 35 |
|
|
|
|
| 4 |
open_clip_torch
|
| 5 |
fastapi
|
| 6 |
gradio==4.35.0
|
| 7 |
+
gradio_client==1.0.1
|
| 8 |
markdown2[all]
|
| 9 |
numpy
|
| 10 |
requests
|
|
|
|
| 23 |
sentencepiece~=0.1.99
|
| 24 |
einops==0.6.1
|
| 25 |
einops-exts==0.0.4
|
| 26 |
+
pydantic>=2.0
|
|
|
|
| 27 |
timm
|
| 28 |
hf_transfer
|
| 29 |
decord
|
|
|
|
| 31 |
tyro
|
| 32 |
scipy
|
| 33 |
rouge
|
| 34 |
+
urllib3~=2.0
|
| 35 |
|