Spaces:
Runtime error
Runtime error
import gradio as gr | |
import subprocess | |
import torch | |
import directories as Dir | |
import process as ps | |
from urllib.parse import urlparse | |
gitblog = "https://bandalcom.github.io/" | |
github = "https://github.com/bandalcom/Postech-KITA_AI-Project" | |
#torch.hub.download_url_to_file('https://huggingface.co/spaces/Nebulae000/NoteCrawling/blob/main/noteimg2.jpg', 'noteimg2.jpg') | |
def HCR(im): | |
ps.clearDir() | |
ps.textDetection(im) | |
ps.textRearrange() | |
ps.textRecognition() | |
#subprocess.call('ls', shell=True) | |
hcr = ps.getHcrResult("/home/user/app"+Dir.txt_file_path) | |
#subprocess.call('cd'+ Dir.yolo_dir, shell=True) | |
ps.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" \ | |
"Text Detection + Text Rearrangement + Text Recognition</p>" \ | |
#"For More Information\n" \ | |
#"<a href='"+ "https%3A%2F%2Fbandalcom.github.io%2F" +"'>GitBlog</a> | <a href='"+ "https%3A%2F%2Fbandalcom.github.io%2F" +"'>Source code</a></p>" | |
#<a href='https://github.com/bandalcom/Postech+KITA_AI-Project'>Source code</a> | |
#examples = [['zidane.jpg'], ['bus.jpg']] | |
#noteimg1 = torch.hub.download_url_to_file('https://ibb.co/JyMt31q', 'noteimg1.jpg') | |
#examples = [[noteimg1]] | |
#examples=examples, | |
gr.Interface(fn=HCR, inputs="image", outputs = "text", title=title, description=description, article=article, analytics_enabled=False).launch(debug=True) |