File size: 1,360 Bytes
30c8b41
 
58c6ff9
30c8b41
 
 
1454a03
30c8b41
 
 
 
 
 
8ee5136
30c8b41
 
 
 
 
 
0e365d4
 
 
 
30c8b41
 
 
 
1454a03
 
30c8b41
c06a98d
 
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
import gradio as gr
import subprocess
import torch
import directories as Dir
import process as ps

#torch.hub.download_url_to_file('https://huggingface.co/spaces/Nebulae000/NoteCrawling/blob/main/noteimg2.jpg', 'noteimg2.jpg')

def HCR(im):
    ps.textDetection(im)
    ps.textRearrange()
    ps.textRecognition()
    hcr = ps.getHcrResult(Dir.txt_file_path)
    #subprocess.call('cd'+ Dir.yolo_dir, shell=True)
    #clearDir()

    return hcr

title = "HCR"
description = "[Postech X KITA] Elite Undergradute AI Strategy Program | AI Project Competition Team 2 OCR Part"
article = "<p style='text-align: center'> Handwritten Text Character Recognition Task \n" \
          "Text Detection + Text Rearrangement + Text Recognition\n" \
          "For More Information\n" \
            "<a href='https://bandalcom.github.io/'>GitBlog</a> | " \
          "<a href='https://github.com/bandalcom/Postech+KITA_AI-Project'>Source code</a></p>"

#<a href='https://github.com/bandalcom/Postech+KITA_AI-Project'>Source code</a>
#examples = [['zidane.jpg'], ['bus.jpg']]
torch.hub.download_url_to_file('https://ibb.co/JyMt31q', 'noteimg1.jpg')
examples = [['noteimg1.jpg']]
#examples=examples,
gr.Interface(fn=HCR, inputs="image", outputs = "text", title=title, description=description, examples=examples, article=article, analytics_enabled=False).launch(
    debug=True)