yukiapple323 commited on
Commit
9178942
1 Parent(s): ab5b27b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -1,23 +1,16 @@
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()
 
1
+ pip install torch torchvision torchaudio
2
 
3
+ import streamlit as st
4
+ import streamlit.components.v1 as components
5
 
6
+ from transformers import AutoTokenizer, AutoModel
7
  tokenizer = AutoTokenizer.from_pretrained("team-lucid/trocr-small-korean")
8
  model = AutoModel.from_pretrained("team-lucid/trocr-small-korean")
9
 
10
+ st.title("Candy Label Scanner")
 
 
 
 
 
 
 
11
 
12
+ # Embed the HTML file in the Streamlit app
13
+ with open("index.html", 'r', encoding='utf-8') as f:
14
+ html_string = f.read()
15
 
16
+ components.html(html_string, height=800, scrolling=True)