Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -56,15 +56,22 @@ class Story(Document):
|
|
56 |
|
57 |
# Utility function for prompts
|
58 |
def make_prompt(entry):
|
59 |
-
return f"### Human, Don't answer inappropriate messages
|
60 |
# f"TELL A STORY, RELATE TO COMPUTER SCIENCE, INCLUDE ASSESMENTS. MAKE IT REALISTIC AND AROUND 500 WORDS, END THE STORY WITH "THE END.": {entry}"
|
61 |
|
62 |
|
63 |
def process_text(text):
|
64 |
parts = text.split('[')
|
65 |
-
clean_parts = [
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
def contains_profanity(text, profanity_set):
|
70 |
words = text.split()
|
|
|
56 |
|
57 |
# Utility function for prompts
|
58 |
def make_prompt(entry):
|
59 |
+
return f"### Human, Don't answer inappropriate messages, make it around 500 words. Don't use ;:{entry} ### Assistant:"
|
60 |
# f"TELL A STORY, RELATE TO COMPUTER SCIENCE, INCLUDE ASSESMENTS. MAKE IT REALISTIC AND AROUND 500 WORDS, END THE STORY WITH "THE END.": {entry}"
|
61 |
|
62 |
|
63 |
def process_text(text):
|
64 |
parts = text.split('[')
|
65 |
+
clean_parts = []
|
66 |
+
for part in parts:
|
67 |
+
sub_parts = part.split(']')
|
68 |
+
if len(sub_parts) > 1:
|
69 |
+
clean_parts.append(sub_parts[1])
|
70 |
+
else:
|
71 |
+
clean_parts.append(sub_parts[0])
|
72 |
+
cleaned_text = ''.join(clean_parts)
|
73 |
+
cleaned_text = re.sub(r'assessment;', '', cleaned_text)
|
74 |
+
return cleaned_text
|
75 |
|
76 |
def contains_profanity(text, profanity_set):
|
77 |
words = text.split()
|