mirror of
https://github.com/283375/arcaea-offline-ocr-model.git
synced 2025-04-19 04:50:17 +00:00
fix: sample issues
This commit is contained in:
parent
6a527bc1ff
commit
5a5b0887c3
@ -133,12 +133,13 @@ class Project:
|
|||||||
raise ValueError(f'Unknown tag "{tag}"')
|
raise ValueError(f'Unknown tag "{tag}"')
|
||||||
|
|
||||||
with self.__sessionmaker() as session:
|
with self.__sessionmaker() as session:
|
||||||
return [
|
sampleMd5s = [
|
||||||
cs.sampleNumpyMd5
|
cs.sampleNumpyMd5
|
||||||
for cs in session.scalars(
|
for cs in session.scalars(
|
||||||
select(ClassifiedSample).where(ClassifiedSample.tag == tag)
|
select(ClassifiedSample).where(ClassifiedSample.tag == tag)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
return [p for p in self.samples if p.stem in sampleMd5s]
|
||||||
|
|
||||||
def getModule(self, moduleName: str):
|
def getModule(self, moduleName: str):
|
||||||
cwdPath = Path(os.getcwd())
|
cwdPath = Path(os.getcwd())
|
||||||
@ -235,8 +236,10 @@ class Project:
|
|||||||
|
|
||||||
def unclassify(self, sample: Path):
|
def unclassify(self, sample: Path):
|
||||||
with self.__sessionmaker() as session:
|
with self.__sessionmaker() as session:
|
||||||
cs = ClassifiedSample()
|
stmt = select(ClassifiedSample).where(
|
||||||
cs.sampleNumpyMd5 = sample.stem
|
ClassifiedSample.sampleNumpyMd5 == sample.stem
|
||||||
|
)
|
||||||
|
cs = session.scalar(stmt)
|
||||||
session.delete(cs)
|
session.delete(cs)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user