Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import tensorflow as tf
|
3 |
|
4 |
-
#
|
5 |
-
model = tf.keras.models.load_model("pain_analysis.h5")
|
6 |
|
7 |
def predict(image):
|
8 |
-
# Preprocess the image as required by your model
|
9 |
-
image = image.resize((150, 150)) # Assuming your model expects 150x150 input
|
10 |
image = np.array(image) / 255.0 # Normalize the image
|
11 |
-
|
12 |
-
|
13 |
-
return
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
# Launch the app
|
22 |
-
if __name__ == "__main__":
|
23 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
import tensorflow as tf
|
4 |
|
5 |
+
# Assuming your model is loaded here
|
6 |
+
# model = tf.keras.models.load_model("pain_analysis.h5")
|
7 |
|
8 |
def predict(image):
|
|
|
|
|
9 |
image = np.array(image) / 255.0 # Normalize the image
|
10 |
+
# Make predictions using your model here
|
11 |
+
# result = model.predict(image)
|
12 |
+
return result
|
13 |
|
14 |
+
# Change this line to use gr.Image directly
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn=predict,
|
17 |
+
inputs=gr.Image(type="numpy"), # Use gr.Image directly
|
18 |
+
outputs="label" # Specify the output type as needed
|
19 |
+
)
|
20 |
|
21 |
+
iface.launch()
|
|
|
|
|
|
|
|