Skip to content

Commit faf8478

Browse files
authored
Merge pull request #99 from ks6088ts-labs/bugfix/issue-98_fix-image-inference
fix image inference
2 parents 03ec950 + 73ef1a4 commit faf8478

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

apps/1_call_azure_openai_chat/query_image.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import base64
3+
import logging
34
from os import getenv
45

56
from dotenv import load_dotenv
@@ -15,10 +16,17 @@ def init_args() -> argparse.Namespace:
1516
parser.add_argument("-f", "--file")
1617
parser.add_argument("-s", "--system", default="You are a professional image analyst. Describe the image.")
1718
parser.add_argument("-p", "--prompt", default="Please describe the content of the image")
19+
parser.add_argument("-v", "--verbose", action="store_true")
1820
return parser.parse_args()
1921

2022

2123
if __name__ == "__main__":
24+
args = init_args()
25+
26+
# Set verbose mode
27+
if args.verbose:
28+
logging.basicConfig(level=logging.DEBUG)
29+
2230
# Parse .env file and set environment variables
2331
load_dotenv()
2432

@@ -29,8 +37,6 @@ def init_args() -> argparse.Namespace:
2937
azure_endpoint=getenv("AZURE_OPENAI_ENDPOINT"),
3038
)
3139

32-
args = init_args()
33-
3440
# Read image file and encode it to base64
3541
try:
3642
with open(args.file, "rb") as f:
@@ -56,7 +62,7 @@ def init_args() -> argparse.Namespace:
5662
},
5763
{
5864
"type": "text",
59-
"content": args.prompt,
65+
"text": args.prompt,
6066
},
6167
],
6268
},

apps/99_streamlit_examples/pages/2_Image_Q&A.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def is_configured():
9191
},
9292
{
9393
"type": "text",
94-
"content": question,
94+
"text": question,
9595
},
9696
],
9797
},

apps/99_streamlit_examples/pages/3_Camera_Q&A.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def is_configured():
8181
},
8282
{
8383
"type": "text",
84-
"content": question,
84+
"text": question,
8585
},
8686
],
8787
},

0 commit comments

Comments
 (0)