Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/1_call_azure_openai_chat/query_image.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import base64
import logging
from os import getenv

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


if __name__ == "__main__":
args = init_args()

# Set verbose mode
if args.verbose:
logging.basicConfig(level=logging.DEBUG)

# Parse .env file and set environment variables
load_dotenv()

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

args = init_args()

# Read image file and encode it to base64
try:
with open(args.file, "rb") as f:
Expand All @@ -56,7 +62,7 @@ def init_args() -> argparse.Namespace:
},
{
"type": "text",
"content": args.prompt,
"text": args.prompt,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion apps/99_streamlit_examples/pages/2_Image_Q&A.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def is_configured():
},
{
"type": "text",
"content": question,
"text": question,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion apps/99_streamlit_examples/pages/3_Camera_Q&A.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def is_configured():
},
{
"type": "text",
"content": question,
"text": question,
},
],
},
Expand Down