Spaces:
Runtime error
Runtime error
File size: 885 Bytes
30ac140 8e9e307 e8a3fe7 30ac140 9105c18 30ac140 d0502ed 22b4794 8a24814 30ac140 9224e35 9a5af09 9224e35 9a5af09 3007cae 85e4efe 3007cae |
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 29 30 31 32 |
import numpy as np
import gradio as gr
from tensorflow import keras
from huggingface_hub import from_pretrained_keras
model = from_pretrained_keras("ISYS/MyNewModel")
def greet(img):
img = np.expand_dims(img, axis=0)
#return np.argmax(model.predict(img)[0])
numb = np.argmax(model.predict(img)[0])
a = numb % 3
return a, numb
def process_sketch(sketch):
img = np.expand_dims(img, axis=0)
output1 = np.argmax(model.predict(img)[0])
output2 = (np.argmax(model.predict(img)[0]) % 3)
return output1, output2
#demo = gr.Interface(fn=process_sketch, inputs="sketchpad", outputs=["text", "text"], title="Распознавание рисунка")
#demo.launch()
iface = gr.Interface(
fn=greet,
inputs="sketchpad",
outputs=["text", "text"],
layout="vertical",
title="Распознавание рисунка"
)
iface.launch() |