chansung commited on
Commit
fdcbba1
Β·
1 Parent(s): 52e665c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import numpy as np
2
  from PIL import Image
3
  import tensorflow as tf
@@ -49,4 +50,20 @@ def get_predictions(image: Image) -> tf.Tensor:
49
  probs = tf.nn.softmax(prediction['logits'], axis=1)
50
 
51
  confidences = {labels[i]: float(probs[0][i]) for i in range(3)}
52
- return confidences
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
  import numpy as np
3
  from PIL import Image
4
  import tensorflow as tf
 
50
  probs = tf.nn.softmax(prediction['logits'], axis=1)
51
 
52
  confidences = {labels[i]: float(probs[0][i]) for i in range(3)}
53
+ return confidences
54
+
55
+ title = "Simple demo for a Image Classification of the Beans Dataset with HF ViT model"
56
+
57
+ description = """
58
+
59
+ """
60
+
61
+ demo = gr.Interface(
62
+ get_predictions,
63
+ gr.inputs.Image(type="pil"),
64
+ gr.outputs.Label(num_top_classes=3),
65
+ allow_flagging="never",
66
+ title=title,
67
+ )
68
+
69
+ demo.launch(debug=True)