Spaces:
Sleeping
Sleeping
double
#2
by
taellinglin
- opened
- models/DaemonOCR.pth β DaemonOCR.pth +0 -0
- models/Daemon.pth β Daemon_OCR.pth +0 -0
- fonts/aAnnyeongHaseyo.otf β aAnnyeongHaseyo.otf +0 -0
- models/aAnnyeongHaseyo.pth β aAnnyeongHaseyo.pth +0 -0
- app.py +3 -16
- fonts/Daemon.otf β daenow.otf +0 -0
- fonts/Glipervelz.ttf +0 -0
- labels/-V1t/20250804052219006262.png +0 -0
- labels/9-Dt/20250804052219012764.png +0 -0
- labels/J7r_/20250804052219007261.png +0 -0
- labels/W_Ly2/20250804052219008263.png +0 -0
- labels/_Zy_Om/20250804052219013767.png +0 -0
- labels/__628/20250804052219010261.png +0 -0
- labels/aG_BL/20250804052219009262.png +0 -0
- labels/kjfiw/20250804052219014768.png +0 -0
- models/Glipervelz.pth +0 -3
models/DaemonOCR.pth β DaemonOCR.pth
RENAMED
|
File without changes
|
models/Daemon.pth β Daemon_OCR.pth
RENAMED
|
File without changes
|
fonts/aAnnyeongHaseyo.otf β aAnnyeongHaseyo.otf
RENAMED
|
File without changes
|
models/aAnnyeongHaseyo.pth β aAnnyeongHaseyo.pth
RENAMED
|
File without changes
|
app.py
CHANGED
|
@@ -170,14 +170,8 @@ def save_model(model, path):
|
|
| 170 |
torch.save(model.state_dict(), path)
|
| 171 |
|
| 172 |
|
| 173 |
-
def load_model(
|
| 174 |
global ocr_model
|
| 175 |
-
model_dir = "./models"
|
| 176 |
-
path = os.path.join(model_dir, filename)
|
| 177 |
-
|
| 178 |
-
if not os.path.exists(path):
|
| 179 |
-
return f"Model file '{path}' does not exist."
|
| 180 |
-
|
| 181 |
model = OCRModel(num_classes=len(CHAR2IDX))
|
| 182 |
model.load_state_dict(torch.load(path, map_location=device))
|
| 183 |
model.to(device)
|
|
@@ -440,15 +434,8 @@ def generate_labels(font_file=None, num_labels: int = 25):
|
|
| 440 |
return [error_img]
|
| 441 |
|
| 442 |
def list_fonts():
|
| 443 |
-
|
| 444 |
-
if
|
| 445 |
-
return ["None"]
|
| 446 |
-
fonts = [
|
| 447 |
-
(f, os.path.join(font_dir, f)) for f in os.listdir(font_dir)
|
| 448 |
-
if f.lower().endswith((".ttf", ".otf"))
|
| 449 |
-
]
|
| 450 |
-
return [("None", "None")] + fonts
|
| 451 |
-
|
| 452 |
|
| 453 |
custom_css = """
|
| 454 |
#label-gallery .gallery-item img {
|
|
|
|
| 170 |
torch.save(model.state_dict(), path)
|
| 171 |
|
| 172 |
|
| 173 |
+
def load_model(path):
|
| 174 |
global ocr_model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
model = OCRModel(num_classes=len(CHAR2IDX))
|
| 176 |
model.load_state_dict(torch.load(path, map_location=device))
|
| 177 |
model.to(device)
|
|
|
|
| 434 |
return [error_img]
|
| 435 |
|
| 436 |
def list_fonts():
|
| 437 |
+
fonts = [f for f in os.listdir() if f.lower().endswith((".ttf", ".otf"))]
|
| 438 |
+
return ["None"] + fonts if fonts else ["None"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
|
| 440 |
custom_css = """
|
| 441 |
#label-gallery .gallery-item img {
|
fonts/Daemon.otf β daenow.otf
RENAMED
|
File without changes
|
fonts/Glipervelz.ttf
DELETED
|
Binary file (20.6 kB)
|
|
|
labels/-V1t/20250804052219006262.png
DELETED
|
Binary file (409 Bytes)
|
|
|
labels/9-Dt/20250804052219012764.png
DELETED
|
Binary file (359 Bytes)
|
|
|
labels/J7r_/20250804052219007261.png
DELETED
|
Binary file (435 Bytes)
|
|
|
labels/W_Ly2/20250804052219008263.png
DELETED
|
Binary file (637 Bytes)
|
|
|
labels/_Zy_Om/20250804052219013767.png
DELETED
|
Binary file (630 Bytes)
|
|
|
labels/__628/20250804052219010261.png
DELETED
|
Binary file (835 Bytes)
|
|
|
labels/aG_BL/20250804052219009262.png
DELETED
|
Binary file (507 Bytes)
|
|
|
labels/kjfiw/20250804052219014768.png
DELETED
|
Binary file (384 Bytes)
|
|
|
models/Glipervelz.pth
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:003cba654cea4a725f1eb920a58a3e43d088c23069b0f22f8f11807c9e68b3fa
|
| 3 |
-
size 4388527
|
|
|
|
|
|
|
|
|
|
|
|