Npps commited on
Commit
effa946
·
verified ·
1 Parent(s): cc886e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -51
app.py CHANGED
@@ -38,54 +38,3 @@ interface = gr.Interface(
38
 
39
  # Launch the Gradio interface
40
  interface.launch()
41
-
42
-
43
-
44
- # import numpy as np
45
- # from tensorflow.keras.preprocessing.image import img_to_array, load_img
46
- # import gradio as gr
47
- # import gradio as gr
48
- # import tensorflow as tf
49
- # import numpy as np
50
- # from PIL import Image
51
- # import cv2
52
- # from tensorflow.keras.preprocessing import image
53
-
54
- # model = tf.keras.models.load_model('Final_Resnet50_Best_model.keras')
55
-
56
- # # Emotion labels dictionary
57
- # emotion_labels = {'angry': 0, 'disgust': 1, 'fear': 2, 'happy': 3, 'neutral': 4, 'sad': 5, 'surprise': 6}
58
- # index_to_emotion = {v: k for k, v in emotion_labels.items()}
59
-
60
- # def prepare_image(img_pil):
61
- # """Preprocess the PIL image to fit your model's input requirements."""
62
- # # Convert the PIL image to a numpy array with the target size
63
- # img = img_pil.resize((224, 224))
64
- # img_array = img_to_array(img)
65
- # img_array = np.expand_dims(img_array, axis=0) # Convert single image to a batch.
66
- # img_array /= 255.0 # Rescale pixel values to [0,1], as done during training
67
- # return img_array
68
-
69
-
70
-
71
- # # Define the Gradio interface
72
- # def predict_emotion(image):
73
- # # Preprocess the image
74
- # processed_image = prepare_image(image)
75
- # # Make prediction using the model
76
- # prediction = model.predict(processed_image)
77
- # # Get the emotion label with the highest probability
78
- # predicted_class = np.argmax(prediction, axis=1)
79
- # predicted_emotion = index_to_emotion.get(predicted_class[0], "Unknown Emotion")
80
- # return predicted_emotion
81
-
82
- # interface = gr.Interface(
83
- # fn=predict_emotion, # Your prediction function
84
- # inputs=gr.Image(type="pil"), # Input for uploading an image, directly compatible with PIL images
85
- # outputs="text", # Output as text displaying the predicted emotion
86
- # title="Emotion Detection",
87
- # description="Upload an image and see the predicted emotion."
88
- # )
89
-
90
- # # Launch the Gradio interface
91
- # interface.launch()
 
38
 
39
  # Launch the Gradio interface
40
  interface.launch()