File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
apps/1_call_azure_openai_chat Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
import argparse
2
2
import base64
3
+ import logging
3
4
from os import getenv
4
5
5
6
from dotenv import load_dotenv
@@ -15,10 +16,17 @@ def init_args() -> argparse.Namespace:
15
16
parser .add_argument ("-f" , "--file" )
16
17
parser .add_argument ("-s" , "--system" , default = "You are a professional image analyst. Describe the image." )
17
18
parser .add_argument ("-p" , "--prompt" , default = "Please describe the content of the image" )
19
+ parser .add_argument ("-v" , "--verbose" , action = "store_true" )
18
20
return parser .parse_args ()
19
21
20
22
21
23
if __name__ == "__main__" :
24
+ args = init_args ()
25
+
26
+ # Set verbose mode
27
+ if args .verbose :
28
+ logging .basicConfig (level = logging .DEBUG )
29
+
22
30
# Parse .env file and set environment variables
23
31
load_dotenv ()
24
32
@@ -29,8 +37,6 @@ def init_args() -> argparse.Namespace:
29
37
azure_endpoint = getenv ("AZURE_OPENAI_ENDPOINT" ),
30
38
)
31
39
32
- args = init_args ()
33
-
34
40
# Read image file and encode it to base64
35
41
try :
36
42
with open (args .file , "rb" ) as f :
You can’t perform that action at this time.
0 commit comments