bvd757 commited on
Commit
0e52473
·
1 Parent(s): fa24024
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -32,17 +32,17 @@ def load_assets():
32
  return tool
33
 
34
 
35
- def extract_text_from_docx(file):
36
- doc = docx.Document(BytesIO(file.getvalue()))
37
- full_text = []
38
- for para in doc.paragraphs:
39
- full_text.append(para.text)
40
- return "\n".join(full_text)
41
  # def extract_text_from_docx(file):
42
- # text = mammoth.convert_to_markdown(file).value
43
- # for symbol in ".,!?()[]:;":
44
- # text = text.replace(f"\{symbol}", symbol)
45
- # return text
 
 
 
 
 
 
46
 
47
 
48
  def main():
@@ -106,7 +106,7 @@ def main():
106
  st.warning("Введите текст для проверки")
107
  else:
108
  text, errors = check_text(text, tool, mode="chat_gpt", highlight_mode=True)
109
- text = text.replace("\n", " ")
110
  if not errors:
111
  st.success("Ошибок не найдено.")
112
  else:
 
32
  return tool
33
 
34
 
 
 
 
 
 
 
35
  # def extract_text_from_docx(file):
36
+ # doc = docx.Document(BytesIO(file.getvalue()))
37
+ # full_text = []
38
+ # for para in doc.paragraphs:
39
+ # full_text.append(para.text)
40
+ # return "\n".join(full_text)
41
+ def extract_text_from_docx(file):
42
+ text = mammoth.convert_to_markdown(file).value
43
+ for symbol in ".,!?()[]:;":
44
+ text = text.replace(f"\{symbol}", symbol)
45
+ return text
46
 
47
 
48
  def main():
 
106
  st.warning("Введите текст для проверки")
107
  else:
108
  text, errors = check_text(text, tool, mode="chat_gpt", highlight_mode=True)
109
+ #text = text.replace("\n", " ")
110
  if not errors:
111
  st.success("Ошибок не найдено.")
112
  else: