Spaces:
Runtime error
Runtime error
Gaurav Panwar
commited on
Commit
•
ad77a39
1
Parent(s):
3421a55
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
-
|
4 |
-
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
|
8 |
-
|
9 |
# Load pre-trained MobileNetV2 model
|
10 |
model = tf.keras.applications.MobileNetV2(weights='imagenet')
|
11 |
|
12 |
-
|
13 |
def predict_difficulty_score(image):
|
14 |
# Load image and preprocess it for the model
|
15 |
img = Image.fromarray(image.astype('uint8'), 'RGB')
|
@@ -29,7 +27,6 @@ def predict_difficulty_score(image):
|
|
29 |
# Return the difficulty score
|
30 |
return difficulty_score
|
31 |
|
32 |
-
|
33 |
# Create a Gradio interface
|
34 |
inputs = gr.inputs.Image(shape=(224, 224))
|
35 |
outputs = gr.outputs.Textbox(label="Difficulty Score")
|
|
|
1 |
import gradio as gr
|
2 |
import tensorflow as tf
|
3 |
+
from tensorflow.compat.v2.experimental import dtensor
|
4 |
+
|
5 |
import numpy as np
|
6 |
from PIL import Image
|
7 |
|
|
|
8 |
# Load pre-trained MobileNetV2 model
|
9 |
model = tf.keras.applications.MobileNetV2(weights='imagenet')
|
10 |
|
|
|
11 |
def predict_difficulty_score(image):
|
12 |
# Load image and preprocess it for the model
|
13 |
img = Image.fromarray(image.astype('uint8'), 'RGB')
|
|
|
27 |
# Return the difficulty score
|
28 |
return difficulty_score
|
29 |
|
|
|
30 |
# Create a Gradio interface
|
31 |
inputs = gr.inputs.Image(shape=(224, 224))
|
32 |
outputs = gr.outputs.Textbox(label="Difficulty Score")
|