Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #17

Merged
merged 2 commits into from
Nov 25, 2024
Merged

Dev #17

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions crud/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ class ScoreAnalysis(BaseModel):
answer: str
pronounce: List[str]

class ScoreResponse(BaseModel):
score: int
class ScoreMeta(BaseModel):
num: int
simillarity: int
ocr_answer: str
analysis: List[ScoreAnalysis]# from pydantic import List

class ScoreResponse(BaseModel):
answers: List[ScoreMeta]

def score_crud(score):
workbook = score.workbook
answer = score.answer
answers = []

"""
ocr request
Expand Down Expand Up @@ -46,8 +51,8 @@ def score_crud(score):
sa=[]
if i not in wrong_list:
print("!!!!!!", ascore[i], atext[i])
sr = ScoreResponse(score=ascore[i], ocr_answer=atext[i], analysis=[])
response[i] = sr
sr = ScoreMeta(num=i, simillarity=ascore[i], ocr_answer=atext[i], analysis=[])
answers.append(sr)
continue

for w in wrong_list[i]:
Expand All @@ -61,12 +66,12 @@ def score_crud(score):
sa.append(ScoreAnalysis(question=saq, answer=saa, pronounce=sap))
print(sa)

sr = ScoreResponse(score=ascore[i], ocr_answer=atext[i], analysis=sa)
sr = ScoreMeta(num=i, simillarity=ascore[i], ocr_answer=atext[i], analysis=sa)
# print(sr)

response[i] = sr
answers.append(sr)


return response
return ScoreResponse(answers=answers)

"""
1:{
Expand Down
Loading