Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import requests
|
| 2 |
import tensorflow as tf
|
| 3 |
-
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
inception_net = tf.keras.applications.MobileNetV2() # load the model
|
|
@@ -9,14 +8,12 @@ inception_net = tf.keras.applications.MobileNetV2() # load the model
|
|
| 9 |
response = requests.get("https://git.io/JJkYN")
|
| 10 |
labels = response.text.split("\n")
|
| 11 |
|
| 12 |
-
|
| 13 |
def classify_image(inp):
|
| 14 |
inp = inp.reshape((-1, 224, 224, 3))
|
| 15 |
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
|
| 16 |
prediction = inception_net.predict(inp).flatten()
|
| 17 |
return {labels[i]: float(prediction[i]) for i in range(1000)}
|
| 18 |
|
| 19 |
-
|
| 20 |
image = gr.Image(shape=(224, 224))
|
| 21 |
label = gr.Label(num_top_classes=3)
|
| 22 |
|
|
|
|
| 1 |
import requests
|
| 2 |
import tensorflow as tf
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
inception_net = tf.keras.applications.MobileNetV2() # load the model
|
|
|
|
| 8 |
response = requests.get("https://git.io/JJkYN")
|
| 9 |
labels = response.text.split("\n")
|
| 10 |
|
|
|
|
| 11 |
def classify_image(inp):
|
| 12 |
inp = inp.reshape((-1, 224, 224, 3))
|
| 13 |
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
|
| 14 |
prediction = inception_net.predict(inp).flatten()
|
| 15 |
return {labels[i]: float(prediction[i]) for i in range(1000)}
|
| 16 |
|
|
|
|
| 17 |
image = gr.Image(shape=(224, 224))
|
| 18 |
label = gr.Label(num_top_classes=3)
|
| 19 |
|