bauerfel commited on
Commit
c9d2c55
·
verified ·
1 Parent(s): 08af4fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -15,6 +15,7 @@ def predict_jellyfish_type(uploaded_file):
15
  with Image.open(uploaded_file) as img:
16
  img = img.resize((150, 150)).convert('RGB') # Convert image to RGB
17
  img_array = np.array(img)
 
18
 
19
  prediction = model.predict(np.expand_dims(img_array, axis=0))
20
  confidences = {labels[i]: np.round(float(prediction[0][i]), 2) for i in range(len(labels))}
@@ -25,8 +26,8 @@ def predict_jellyfish_type(uploaded_file):
25
  # Define the Gradio interface
26
  iface = gr.Interface(
27
  fn=predict_jellyfish_type, # Function to process the input
28
- inputs=gr.File(label="Upload File"), # File upload widget
29
- outputs="text", # Output type
30
  title="Jellyfish Classifier", # Title of the interface
31
  examples=["images/barrel_jellyfish.jpeg", "images/blue_jellyfish.jpeg", "images/compass_jellyfish.jpeg", "images/lions_mane_jellyfish.jpeg", "images/mauve_stinger_jellyfish.jpeg", "images/Moon_jellyfish.jpeg"],
32
  description="Upload a picture of a Jellyfish (barrel Gefährlichkeit: Niedrig, blue Gefährlichkeit: Moderat, compass Gefährlichkeit: Moderat, lions mane Gefährlichkeit: Hoch, mauve stinger Gefährlichkeit: Moderat bis Hoch, Moon Gefährlichkeit: Niedrig) " # Description of the interface
 
15
  with Image.open(uploaded_file) as img:
16
  img = img.resize((150, 150)).convert('RGB') # Convert image to RGB
17
  img_array = np.array(img)
18
+ print(image.shape)
19
 
20
  prediction = model.predict(np.expand_dims(img_array, axis=0))
21
  confidences = {labels[i]: np.round(float(prediction[0][i]), 2) for i in range(len(labels))}
 
26
  # Define the Gradio interface
27
  iface = gr.Interface(
28
  fn=predict_jellyfish_type, # Function to process the input
29
+ inputs=input_image, #inputs=gr.File(label="Upload File"), # File upload widget
30
+ outputs=gr.Label(), #outputs="text", # Output type
31
  title="Jellyfish Classifier", # Title of the interface
32
  examples=["images/barrel_jellyfish.jpeg", "images/blue_jellyfish.jpeg", "images/compass_jellyfish.jpeg", "images/lions_mane_jellyfish.jpeg", "images/mauve_stinger_jellyfish.jpeg", "images/Moon_jellyfish.jpeg"],
33
  description="Upload a picture of a Jellyfish (barrel Gefährlichkeit: Niedrig, blue Gefährlichkeit: Moderat, compass Gefährlichkeit: Moderat, lions mane Gefährlichkeit: Hoch, mauve stinger Gefährlichkeit: Moderat bis Hoch, Moon Gefährlichkeit: Niedrig) " # Description of the interface