eagle0504 commited on
Commit
f80a358
1 Parent(s): b8b0c3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -82,7 +82,8 @@ def main():
82
 
83
  if image is not None:
84
  # Display the captured image
85
- st.image(image, caption="Captured Image", use_column_width=True)
 
86
 
87
  # Convert the image to PIL format and resize
88
  pil_image = Image.open(image)
@@ -148,14 +149,17 @@ def main():
148
  with st.expander("Raw output from Gemini"):
149
  st.write(response)
150
 
 
 
 
 
 
 
 
 
 
151
  # Display the response
152
  try:
153
- text_from_response = response["candidates"][0]["content"]["parts"][0][
154
- "text"
155
- ]
156
- with st.spinner("Wait for it..."):
157
- st.write(text_from_response)
158
-
159
  st.sidebar.success(
160
  "Check the box if you want to see a sample retrieved (we had a template of keys, in practice this depends on the stakeholders) information to download (only use this if this is a document-based task)! 👇"
161
  )
 
82
 
83
  if image is not None:
84
  # Display the captured image
85
+ with st.expander("Expand/collapse the uploaded image:"):
86
+ st.image(image, caption="Captured Image", use_column_width=True)
87
 
88
  # Convert the image to PIL format and resize
89
  pil_image = Image.open(image)
 
149
  with st.expander("Raw output from Gemini"):
150
  st.write(response)
151
 
152
+ try:
153
+ text_from_response = response["candidates"][0]["content"]["parts"][0][
154
+ "text"
155
+ ]
156
+ with st.spinner("Wait for it..."):
157
+ st.write(text_from_response)
158
+ except:
159
+ st.warning("Please check the Gemini API as we do not have response from it.")
160
+
161
  # Display the response
162
  try:
 
 
 
 
 
 
163
  st.sidebar.success(
164
  "Check the box if you want to see a sample retrieved (we had a template of keys, in practice this depends on the stakeholders) information to download (only use this if this is a document-based task)! 👇"
165
  )