mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-13 11:57:29 +08:00
Update README.md
This commit is contained in:
parent
f691e0fe29
commit
aa26636c27
15
README.md
15
README.md
@ -40,20 +40,15 @@ import gradio
|
||||
import tensorflow as tf
|
||||
from imagenetlabels import idx_to_labels
|
||||
|
||||
graph = tf.get_default_graph()
|
||||
sess = tf.keras.backend.get_session()
|
||||
|
||||
def classify_image(inp):
|
||||
with graph.as_default():
|
||||
with sess.as_default():
|
||||
inp = inp.reshape((1, 224, 224, 3))
|
||||
prediction = mobile_net.predict(inp).flatten()
|
||||
return {idx_to_labels[i].split(',')[0]: float(prediction[i]) for i in range(1000)}
|
||||
inp = inp.reshape((1, 224, 224, 3))
|
||||
prediction = mobile_net.predict(inp).flatten()
|
||||
return {idx_to_labels[i].split(',')[0]: float(prediction[i]) for i in range(1000)}
|
||||
|
||||
imagein = gradio.inputs.ImageIn(shape=(224, 224, 3))
|
||||
imagein = gradio.inputs.Image(shape=(224, 224, 3))
|
||||
label = gradio.outputs.Label(num_top_classes=3)
|
||||
|
||||
gr.Interface(classify_image, imagein, label).launch();
|
||||
gr.Interface(classify_image, imagein, label, capture_session=True).launch();
|
||||
```
|
||||
|
||||

|
||||
|
Loading…
Reference in New Issue
Block a user