Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pip install torch torchvision torchaudio gradio transformers
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
from transformers import AutoTokenizer, AutoModel
|
| 5 |
+
|
| 6 |
+
# Load the tokenizer and model
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained("team-lucid/trocr-small-korean")
|
| 8 |
+
model = AutoModel.from_pretrained("team-lucid/trocr-small-korean")
|
| 9 |
+
|
| 10 |
+
def read_html_file():
|
| 11 |
+
with open("index.html", 'r', encoding='utf-8') as f:
|
| 12 |
+
html_string = f.read()
|
| 13 |
+
return html_string
|
| 14 |
+
|
| 15 |
+
def scan_candy_label():
|
| 16 |
+
html_content = read_html_file()
|
| 17 |
+
return html_content
|
| 18 |
+
|
| 19 |
+
title = "Candy Label Scanner"
|
| 20 |
+
description = "A web app to scan and display candy labels."
|
| 21 |
+
|
| 22 |
+
iface = gr.Interface(fn=scan_candy_label, inputs=[], outputs="html", title=title, description=description)
|
| 23 |
+
iface.launch()
|