Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -83,8 +83,11 @@ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map='balanced')
|
|
83 |
|
84 |
def filter_text(text):
|
85 |
"""Filters out the text up to and including 'Rewritten Prompt:'."""
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
88 |
return filtered_text
|
89 |
|
90 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
83 |
|
84 |
def filter_text(text):
|
85 |
"""Filters out the text up to and including 'Rewritten Prompt:'."""
|
86 |
+
phrase = "Rewritten Prompt: "
|
87 |
+
pattern = f"(.*?){re.escape(phrase)}(.*)"
|
88 |
+
match = re.search(pattern, text)
|
89 |
+
# match = re.search(pattern, text,flags=re.DOTALL)
|
90 |
+
filtered_text = match.group(2)
|
91 |
return filtered_text
|
92 |
|
93 |
MAX_SEED = np.iinfo(np.int32).max
|