Spaces:
Runtime error
Runtime error
correction part separated by para
Browse files- app.py +10 -0
- humanize.py +3 -4
app.py
CHANGED
@@ -28,6 +28,16 @@ def format_and_correct(text: str) -> str:
|
|
28 |
return clean_text(corrected_text)
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
def generate_prompt(settings: Dict[str, str]) -> str:
|
32 |
"""Generate a detailed prompt based on user settings."""
|
33 |
prompt = f"""
|
|
|
28 |
return clean_text(corrected_text)
|
29 |
|
30 |
|
31 |
+
def format_and_correct_para(text: str) -> str:
|
32 |
+
paragraphs = text.split("\n")
|
33 |
+
corrected_paragraphs = []
|
34 |
+
for paragraph in paragraphs:
|
35 |
+
corrected = format_and_correct(paragraph)
|
36 |
+
corrected_paragraphs.append(corrected)
|
37 |
+
corrected_text = "\n\n".join(corrected_paragraphs)
|
38 |
+
return corrected_text
|
39 |
+
|
40 |
+
|
41 |
def generate_prompt(settings: Dict[str, str]) -> str:
|
42 |
"""Generate a detailed prompt based on user settings."""
|
43 |
prompt = f"""
|
humanize.py
CHANGED
@@ -98,11 +98,10 @@ def paraphrase_text(
|
|
98 |
)
|
99 |
paraphrased_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
100 |
paraphrases.append(paraphrased_sentence)
|
101 |
-
|
102 |
-
|
103 |
combined_paraphrase = " ".join(paraphrases)
|
104 |
humanized_paragraphs.append(combined_paraphrase)
|
105 |
|
106 |
-
humanized_text = "\n
|
107 |
-
print(humanized_text)
|
108 |
return humanized_text
|
|
|
98 |
)
|
99 |
paraphrased_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
100 |
paraphrases.append(paraphrased_sentence)
|
101 |
+
print(f"\nOriginal: {sentence}")
|
102 |
+
print(f"Paraphrased: {paraphrased_sentence}")
|
103 |
combined_paraphrase = " ".join(paraphrases)
|
104 |
humanized_paragraphs.append(combined_paraphrase)
|
105 |
|
106 |
+
humanized_text = "\n\n".join(humanized_paragraphs)
|
|
|
107 |
return humanized_text
|