usmanyousaf
commited on
Commit
•
effc91a
1
Parent(s):
d73cd3f
Update app.py
Browse files
app.py
CHANGED
@@ -93,7 +93,7 @@ async def check_grammar(transcription: str = Form(...), language: str = Form(...
|
|
93 |
|
94 |
|
95 |
def calculate_score(feedback: str) -> int:
|
96 |
-
|
97 |
Calculate score based on feedback content.
|
98 |
This function searches for the keyword 'SCORE=' or similar variations
|
99 |
(SCORE:, score:, etc.) and extracts the score value.
|
@@ -103,11 +103,8 @@ def calculate_score(feedback: str) -> int:
|
|
103 |
match = re.search(r'(SCORE=|score=|SCORE:|score:|SCORE = )\s*(\d+)', feedback)
|
104 |
|
105 |
if match:
|
106 |
-
# Extract and return the score as an integer
|
107 |
return int(match.group(2))
|
108 |
-
|
109 |
-
# Return a default score of 0 if no score is found in the feedback
|
110 |
-
return 0
|
111 |
if __name__ == "__main__":
|
112 |
import uvicorn
|
113 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
93 |
|
94 |
|
95 |
def calculate_score(feedback: str) -> int:
|
96 |
+
"""
|
97 |
Calculate score based on feedback content.
|
98 |
This function searches for the keyword 'SCORE=' or similar variations
|
99 |
(SCORE:, score:, etc.) and extracts the score value.
|
|
|
103 |
match = re.search(r'(SCORE=|score=|SCORE:|score:|SCORE = )\s*(\d+)', feedback)
|
104 |
|
105 |
if match:
|
|
|
106 |
return int(match.group(2))
|
107 |
+
return 0
|
|
|
|
|
108 |
if __name__ == "__main__":
|
109 |
import uvicorn
|
110 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|