AI-ANK commited on
Commit
72d1d6d
1 Parent(s): 8ef433c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -61,12 +61,12 @@ def create_chat_engine(img_desc, api_key):
61
  return chat_engine
62
 
63
  # Function to handle chat interaction
64
- def process_image_and_chat(image_file, user_input):
65
- if image_file is None:
 
66
  return "Please capture an image."
67
 
68
- image_data = BytesIO(image_file)
69
- img_desc = get_image_caption(image_data)
70
  chat_engine = create_chat_engine(img_desc, os.environ["GOOGLE_API_KEY"])
71
 
72
  if user_input:
@@ -78,6 +78,7 @@ def process_image_and_chat(image_file, user_input):
78
  else:
79
  return "Ask me anything about the uploaded image."
80
 
 
81
  # Define Gradio interface
82
  image_input = gr.Image(sources=["webcam"], type="numpy")
83
  text_input = gr.Textbox(label="Ask me about the image:")
 
61
  return chat_engine
62
 
63
  # Function to handle chat interaction
64
+ # Function to handle chat interaction
65
+ def process_image_and_chat(image_array, user_input):
66
+ if image_array is None:
67
  return "Please capture an image."
68
 
69
+ img_desc = get_image_caption(image_array)
 
70
  chat_engine = create_chat_engine(img_desc, os.environ["GOOGLE_API_KEY"])
71
 
72
  if user_input:
 
78
  else:
79
  return "Ask me anything about the uploaded image."
80
 
81
+
82
  # Define Gradio interface
83
  image_input = gr.Image(sources=["webcam"], type="numpy")
84
  text_input = gr.Textbox(label="Ask me about the image:")