Spaces:
Runtime error
Runtime error
asd
Browse files
app.py
CHANGED
@@ -71,6 +71,14 @@ pipe = pipeline("text-classification", model="tommyliphys/ai-detector-distilbert
|
|
71 |
def get_prediction(text):
|
72 |
return pipe(text)[0]
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
# function to humanize the text
|
75 |
def humanize_text(AI_text):
|
76 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
@@ -103,6 +111,8 @@ def humanize_text(AI_text):
|
|
103 |
break
|
104 |
|
105 |
attempts += 1
|
|
|
|
|
106 |
|
107 |
return humanized_text
|
108 |
|
|
|
71 |
def get_prediction(text):
|
72 |
return pipe(text)[0]
|
73 |
|
74 |
+
def clean_text(text):
|
75 |
+
# Remove double asterisks
|
76 |
+
text = re.sub(r'\*\*', '', text)
|
77 |
+
# Remove double hash symbols
|
78 |
+
text = re.sub(r'##', '', text)
|
79 |
+
return text
|
80 |
+
|
81 |
+
|
82 |
# function to humanize the text
|
83 |
def humanize_text(AI_text):
|
84 |
"""Humanizes the provided AI text using the fine-tuned model."""
|
|
|
111 |
break
|
112 |
|
113 |
attempts += 1
|
114 |
+
|
115 |
+
humanize_text=clean_text(clean_text)
|
116 |
|
117 |
return humanized_text
|
118 |
|