Spaces:
Running
Running
Vlad Bastina commited on
Commit ·
fc3f7d8
1
Parent(s): 9652420
style and description
Browse files- app.py +17 -3
- style.css +32 -0
- zega_logo.svg +15 -0
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from PIL import Image
|
|
| 4 |
import numpy as np
|
| 5 |
from gemini_correction import AiCorrection
|
| 6 |
from pathlib import Path
|
|
|
|
| 7 |
|
| 8 |
@st.cache_resource()
|
| 9 |
def load_useful():
|
|
@@ -24,10 +25,23 @@ def load_css(file_name):
|
|
| 24 |
|
| 25 |
|
| 26 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
load_css("style.css")
|
| 28 |
-
st.title("Zega OCR Demo")
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Initialize PaddleOCR and AI Corrector
|
| 33 |
ocr, ai_corrector = load_useful()
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
from gemini_correction import AiCorrection
|
| 6 |
from pathlib import Path
|
| 7 |
+
import os
|
| 8 |
|
| 9 |
@st.cache_resource()
|
| 10 |
def load_useful():
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
def main():
|
| 28 |
+
st.markdown("""
|
| 29 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 30 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 31 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
|
| 32 |
+
""", unsafe_allow_html=True)
|
| 33 |
load_css("style.css")
|
| 34 |
+
st.title("Zega Optical Character Recognition (OCR) Demo")
|
| 35 |
+
logo_path = "zega_logo.svg"
|
| 36 |
+
if os.path.exists(logo_path):
|
| 37 |
+
with open(logo_path, "r", encoding="utf-8") as f:
|
| 38 |
+
svg_content = f.read()
|
| 39 |
+
|
| 40 |
+
st.sidebar.markdown(svg_content,unsafe_allow_html=True)
|
| 41 |
+
else:
|
| 42 |
+
st.sidebar.warning("Logo zega_logo.PNG not found.")
|
| 43 |
+
st.write('''This demo lets you upload an image (or use a sample contract) to extract text with OCR.
|
| 44 |
+
Then, it sends that text to an AI to clean it up and make it sound better.''')
|
| 45 |
|
| 46 |
# Initialize PaddleOCR and AI Corrector
|
| 47 |
ocr, ai_corrector = load_useful()
|
style.css
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
h1, h2, h3, h4, h5, h6 {
|
| 2 |
+
font-family: "Space Grotesk", sans-serif !important;
|
| 3 |
+
font-optical-sizing: auto !important;
|
| 4 |
+
font-weight: 700 !important;
|
| 5 |
+
font-style: normal !important;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
h1, h2 {
|
| 9 |
+
letter-spacing: -1px !important;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
h1 {
|
| 13 |
+
font-size: 36px !important;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
h2 {
|
| 17 |
+
font-size: 27px !important;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.st-emotion-cache-1dp5vir {
|
| 21 |
+
background-image: linear-gradient(90deg, rgb(65, 105, 225), rgb(0, 255, 255)) !important;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
body {
|
| 25 |
+
font-family: 'Inter Tight', Arial, Helvetica, sans-serif !important;
|
| 26 |
+
font-size: 14px !important;
|
| 27 |
+
text-align: left !important;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
p , textarea {
|
| 31 |
+
font-family: 'Inter Tight', Arial, Helvetica, sans-serif !important;
|
| 32 |
+
}
|
zega_logo.svg
ADDED
|
|