vaniv commited on
Commit
425aa5c
·
verified ·
1 Parent(s): c219f57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -64,11 +64,14 @@ def predict(image):
64
  return f"Predicted category: {pred_class}\nRecommended complementary item: {garment_recommendation} in {color_recommendation}"
65
 
66
  def gradio_predict(image):
 
 
 
67
  return predict(image)
68
 
69
  interface = gr.Interface(
70
  fn=gradio_predict,
71
- inputs=gr.Image(type="pil"), # Changed to use 'type="pil"' instead of 'shape'
72
  outputs="text",
73
  title="Outfit Recommender",
74
  description="Upload an image of a garment to get a recommendation for a complementary outfit based on fashion theory."
 
64
  return f"Predicted category: {pred_class}\nRecommended complementary item: {garment_recommendation} in {color_recommendation}"
65
 
66
  def gradio_predict(image):
67
+ if isinstance(image, np.ndarray):
68
+ # Convert numpy array to PIL Image
69
+ image = Image.fromarray(image.astype('uint8'), 'RGB')
70
  return predict(image)
71
 
72
  interface = gr.Interface(
73
  fn=gradio_predict,
74
+ inputs=gr.Image(),
75
  outputs="text",
76
  title="Outfit Recommender",
77
  description="Upload an image of a garment to get a recommendation for a complementary outfit based on fashion theory."