File size: 703 Bytes
08481e3
cf06aeb
fe42a64
e501738
f92c902
08481e3
 
c4b13d2
0b175d4
f92c902
c4b13d2
 
 
08481e3
 
964233d
00a2a00
964233d
179a347
964233d
 
c4b13d2
179a347
 
 
 
10d750f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import numpy as np
import gradio as gr
from PIL import Image
import tensorflow as tf

def image_mod(image):
    # img = Image.fromarray(image['composite'])
    model = tf.keras.models.load_model('my_model.keras')
    test_img = np.array(image['composite']).reshape(1, test_img.shape[0], test_img.shape[1], 1)
    prediction = model.predict(test_img)
    pred   = np.argmax(prediction, axis=1)[0]
    return pred


title = "Draw to Search"
description = "Using the power of AI to detect the number you draw!"

demo = gr.Interface(
  fn=image_mod, 
  inputs='sketchpad',
  outputs='text',
  title=title,
  description=description,
  live=True)

demo.launch(share=False)
# demo.launch(debug=True)