leilaaaaa commited on
Commit
56274b2
·
verified ·
1 Parent(s): fb50c2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -14,6 +14,7 @@ def image_to_base64(image):
14
  img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
15
  return img_str
16
 
 
17
  # Function to interact with LLAVA model
18
  # Function to interact with LLAVA model
19
  def respond(
@@ -37,8 +38,8 @@ def respond(
37
  messages.append({"role": "user", "content": message})
38
 
39
  if image:
40
- # Convert image to base64
41
- image_b64 = image_to_base64(image)
42
  messages.append({"role": "user", "content": "Image uploaded", "image": image_b64})
43
 
44
  # Call Hugging Face model for response
@@ -59,6 +60,7 @@ def respond(
59
  print(f"Error in respond function: {str(e)}")
60
  yield f"Error occurred: {str(e)}"
61
 
 
62
  # Debugging print statements
63
  print("Starting Gradio interface setup...")
64
  try:
 
14
  img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
15
  return img_str
16
 
17
+ # Function to interact with LLAVA model
18
  # Function to interact with LLAVA model
19
  # Function to interact with LLAVA model
20
  def respond(
 
38
  messages.append({"role": "user", "content": message})
39
 
40
  if image:
41
+ # Handle single image input
42
+ image_b64 = image_to_base64(image) # Convert image to base64
43
  messages.append({"role": "user", "content": "Image uploaded", "image": image_b64})
44
 
45
  # Call Hugging Face model for response
 
60
  print(f"Error in respond function: {str(e)}")
61
  yield f"Error occurred: {str(e)}"
62
 
63
+
64
  # Debugging print statements
65
  print("Starting Gradio interface setup...")
66
  try: