nehapasricha94 commited on
Commit
ca568da
1 Parent(s): 967c1f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -93,6 +93,10 @@ def analyze_patterns(image):
93
  # Main function to process image and analyze emotional expression
94
  def analyze_emotion_from_image(image):
95
  try:
 
 
 
 
96
  # Analyze colors
97
  dominant_colors = analyze_colors(image)
98
  if dominant_colors is None:
@@ -107,6 +111,7 @@ def analyze_emotion_from_image(image):
107
  except Exception as e:
108
  return f"Error processing image: {str(e)}"
109
 
 
110
  # Gradio interface to upload image files and perform analysis
111
  iface = gr.Interface(fn=analyze_emotion_from_image, inputs="image", outputs="text")
112
 
 
93
  # Main function to process image and analyze emotional expression
94
  def analyze_emotion_from_image(image):
95
  try:
96
+ # Ensure the input image is a PIL image
97
+ if isinstance(image, np.ndarray):
98
+ image = Image.fromarray(image) # Convert to PIL Image if it's a NumPy array
99
+
100
  # Analyze colors
101
  dominant_colors = analyze_colors(image)
102
  if dominant_colors is None:
 
111
  except Exception as e:
112
  return f"Error processing image: {str(e)}"
113
 
114
+
115
  # Gradio interface to upload image files and perform analysis
116
  iface = gr.Interface(fn=analyze_emotion_from_image, inputs="image", outputs="text")
117