Spaces:
Runtime error
Runtime error
lorocksUMD
commited on
Commit
•
7222efe
1
Parent(s):
2fb0735
Update script.py
Browse files
script.py
CHANGED
@@ -18,22 +18,29 @@ from llava.constants import (
|
|
18 |
)
|
19 |
from llava.conversation import conv_templates, SeparatorStyle
|
20 |
|
|
|
21 |
import torch
|
22 |
import requests
|
23 |
from PIL import Image
|
24 |
from io import BytesIO
|
25 |
import re
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Line 138 uncomment the cuda() to use GPUs
|
29 |
|
30 |
# device = "cpu"
|
31 |
-
device =
|
32 |
|
33 |
-
prompt =
|
34 |
-
image_file =
|
35 |
|
36 |
-
model_path =
|
37 |
|
38 |
|
39 |
|
|
|
18 |
)
|
19 |
from llava.conversation import conv_templates, SeparatorStyle
|
20 |
|
21 |
+
import argparse
|
22 |
import torch
|
23 |
import requests
|
24 |
from PIL import Image
|
25 |
from io import BytesIO
|
26 |
import re
|
27 |
|
28 |
+
parser = argparse.ArgumentParser()
|
29 |
+
parser.add_argument("--model-path", type=str, default="liuhaotian/llava-v1.6-mistral-7b")
|
30 |
+
parser.add_argument("--image-file", type=str, required=True)
|
31 |
+
parser.add_argument("--inference-type", type=str, default="auto")
|
32 |
+
parser.add_argument("--prompt", type=str, default="Explain this image")
|
33 |
+
cmd_args = parser.parse_args()
|
34 |
|
35 |
# Line 138 uncomment the cuda() to use GPUs
|
36 |
|
37 |
# device = "cpu"
|
38 |
+
device = cmd_args.inference_type
|
39 |
|
40 |
+
prompt = cmd_args.prompt
|
41 |
+
image_file = cmd_args.image_file
|
42 |
|
43 |
+
model_path = cmd_args.model_path
|
44 |
|
45 |
|
46 |
|