fix_v2
Browse files
app.py
CHANGED
@@ -50,7 +50,13 @@ def check_text(text, tool):
|
|
50 |
'message': generate_gpt_comment(match.message, match.context),
|
51 |
}
|
52 |
errors.append(error_info)
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
def main():
|
@@ -90,7 +96,7 @@ def main():
|
|
90 |
if not text.strip():
|
91 |
st.warning("Введите текст для проверки")
|
92 |
else:
|
93 |
-
errors = check_text(text, tool)
|
94 |
if not errors:
|
95 |
st.success("Ошибок не найдено! 👍")
|
96 |
else:
|
|
|
50 |
'message': generate_gpt_comment(match.message, match.context),
|
51 |
}
|
52 |
errors.append(error_info)
|
53 |
+
|
54 |
+
errors = sorted(errors, key=lambda x: x['end'])
|
55 |
+
|
56 |
+
for i, error in enumerate(errors[::-1]):
|
57 |
+
text = text[:error['end']] + f"({len(errors) - i})" + text[error['end']:]
|
58 |
+
|
59 |
+
return text, errors
|
60 |
|
61 |
|
62 |
def main():
|
|
|
96 |
if not text.strip():
|
97 |
st.warning("Введите текст для проверки")
|
98 |
else:
|
99 |
+
text, errors = check_text(text, tool)
|
100 |
if not errors:
|
101 |
st.success("Ошибок не найдено! 👍")
|
102 |
else:
|