Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,13 +33,11 @@ if uploaded_file and openai.api_key and analyze_button:
|
|
33 |
with st.spinner("Analyzing the image..."):
|
34 |
base64_image = encode_image(uploaded_file)
|
35 |
prompt_text = (
|
36 |
-
"You are a highly knowledgeable
|
37 |
"Your task is to examine the following image in detail. "
|
38 |
-
"Provide a comprehensive, factual, and
|
39 |
-
"Highlight key elements and their significance, and present your analysis in clear, well-structured
|
40 |
-
"
|
41 |
-
"Assume the reader has a basic understanding of scientific concepts."
|
42 |
-
"Create a detailed image caption in bold explaining in short."
|
43 |
)
|
44 |
|
45 |
if show_details and additional_details:
|
@@ -53,7 +51,7 @@ if uploaded_file and openai.api_key and analyze_button:
|
|
53 |
|
54 |
try:
|
55 |
# Make the request to OpenAI and handle streaming if required
|
56 |
-
response = openai.chat.completions.create(model="gpt-4-vision-preview", messages=messages, max_tokens=
|
57 |
st.write(response.choices[0].message.content)
|
58 |
except Exception as e:
|
59 |
st.error(f"An error occurred: {e}")
|
|
|
33 |
with st.spinner("Analyzing the image..."):
|
34 |
base64_image = encode_image(uploaded_file)
|
35 |
prompt_text = (
|
36 |
+
"You are a highly knowledgeable accessibility expert. "
|
37 |
"Your task is to examine the following image in detail. "
|
38 |
+
"Provide a comprehensive, factual, and accurate explanation of what the image depicts. "
|
39 |
+
"Highlight key elements and their significance, and present your analysis in clear, well-structured format. "
|
40 |
+
"Create a detailed image caption in explaining in 150 words or less."
|
|
|
|
|
41 |
)
|
42 |
|
43 |
if show_details and additional_details:
|
|
|
51 |
|
52 |
try:
|
53 |
# Make the request to OpenAI and handle streaming if required
|
54 |
+
response = openai.chat.completions.create(model="gpt-4-vision-preview", messages=messages, max_tokens=150)
|
55 |
st.write(response.choices[0].message.content)
|
56 |
except Exception as e:
|
57 |
st.error(f"An error occurred: {e}")
|