File size: 2,008 Bytes
27b04aa
 
6b42630
27b04aa
 
e620961
27b04aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e620961
 
6b42630
27b04aa
 
 
 
6b42630
27b04aa
 
 
474da68
6b42630
27b04aa
 
6b42630
27b04aa
6b42630
 
27b04aa
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'''

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()