MilkoTv's picture
replaced title
e620961
'''
File: recognize.py
Project: BulgarianPatternsRecognizer
Author: Milko Videv (milko.videv@thalesgroup.com)
-----
Last Modified: Wednesday, 6th March 2024 9:34:16 am
Modified By: Milko Videv (milko.videv@thalesgroup.com>)
-----
Copyright 2017 - 2024, Thales DIS, MCS SSH
-----
HISTORY:
Date By Comments
---------- --- ---------------------------------------------------------
'''
import gradio as gr
from predict import *
from tools import *
from gradio.themes.utils.colors import slate # type: ignore
def render():
title = "Невронна мрежа за разпознаване на български, индийски и японски шевици"
description = "Тренирах я с около 400 снимки на шевици от интернет. Заредете снимка на шевица от 'Снимки за тестване' по-долу или домъкнете една от 3-те примерни"
article = "<a href='https://www.google.com/search?q=bulgarian+patterns+images'>Снимки за тестване"
examples = [
'./samples/bulgarian.jpg',
'./samples/indian.jpg',
'./samples/japanese.jpg'
]
demo = gr.Interface(fn=predict,
theme=gr.themes.Monochrome(primary_hue=slate),
inputs=gr.components.Image(width=512, height=512, interactive=True, label="Шевица"),
outputs=gr.components.Label(num_top_classes=3, label="Резултат"),
title=title,
description=description,
article=article,
examples=examples,
allow_flagging="never",
live=True,
css=
"#component-3 { background-color: rgb(192, 192, 192) !important; }"
"#component-3 H1 { margin: 1.5rem 0 1.5rem 0; color: #252873; !important;}"
"footer { display: none !important; }"
)
demo.queue().launch()
if __name__ == "__main__":
render()