@@ -14,9 +14,9 @@ def parse_args():
14
14
parser = ArgumentParser (description = "Chat with UForm generative model" )
15
15
16
16
parser .add_argument ("--model" , type = str , default = "unum-cloud/uform-gen-chat" )
17
- parser .add_argument ("--image_path " , type = str , help = "" , required = True )
17
+ parser .add_argument ("--image " , type = str , help = "" , required = True )
18
18
parser .add_argument ("--device" , type = str , required = True )
19
- parser .add_argument ("--fp16" , action = "store_true" )
19
+ parser .add_argument ("--fp16" , action = "store_true" )
20
20
21
21
return parser .parse_args ()
22
22
@@ -30,18 +30,18 @@ def run_chat(opts, model, processor):
30
30
31
31
messages = [{"role" : "system" , "content" : "You are a helpful assistant." }]
32
32
is_first_message = True
33
- if opts .image_path .startswith ("http" ):
33
+ if opts .image .startswith ("http" ):
34
34
image = (
35
35
processor .image_processor (
36
- Image .open (requests .get (opts .image_path , stream = True ).raw )
36
+ Image .open (requests .get (opts .image , stream = True ).raw )
37
37
)
38
38
.unsqueeze (0 )
39
39
.to (torch .bfloat16 if opts .fp16 else torch .float32 )
40
40
.to (opts .device )
41
41
)
42
42
else :
43
43
image = (
44
- processor .image_processor (Image .open (opts .image_path ))
44
+ processor .image_processor (Image .open (opts .image ))
45
45
.unsqueeze (0 )
46
46
.to (torch .bfloat16 if opts .fp16 else torch .float32 )
47
47
.to (opts .device )
0 commit comments