coeuslearning
commited on
Commit
•
37f0e68
1
Parent(s):
ce33d9d
Update app.py
Browse files
app.py
CHANGED
@@ -68,13 +68,7 @@ def generate(
|
|
68 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
69 |
t.start()
|
70 |
|
71 |
-
# outputs = []
|
72 |
-
# for text in streamer:
|
73 |
-
# outputs.append(text)
|
74 |
-
# concatenated_outputs = " ".join(outputs)
|
75 |
-
# yield concatenated_outputs
|
76 |
concatenated_outputs = "".join([r"{}".format(text) for text in streamer])
|
77 |
-
# yield concatenated_outputs
|
78 |
|
79 |
# Mask the output here
|
80 |
masked_output = mask_with_protecto(concatenated_outputs)
|
@@ -82,14 +76,12 @@ def generate(
|
|
82 |
yield masked_output
|
83 |
|
84 |
|
|
|
85 |
def format_for_html(text):
|
86 |
text = text.replace("<", "<")
|
87 |
text = text.replace(">", ">")
|
88 |
return text
|
89 |
|
90 |
-
# Using the function
|
91 |
-
api_output = "N7JI9bzqbf M1L4LPGkyj is the CEO of Apple Inc."
|
92 |
-
formatted_output = format_for_html(api_output)
|
93 |
|
94 |
def mask_with_protecto(text_for_prompt):
|
95 |
mask_request_url = "https://trial.protecto.ai/api/vault/mask"
|
|
|
68 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
69 |
t.start()
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
concatenated_outputs = "".join([r"{}".format(text) for text in streamer])
|
|
|
72 |
|
73 |
# Mask the output here
|
74 |
masked_output = mask_with_protecto(concatenated_outputs)
|
|
|
76 |
yield masked_output
|
77 |
|
78 |
|
79 |
+
# Ensuring entity tags are properly rendered
|
80 |
def format_for_html(text):
|
81 |
text = text.replace("<", "<")
|
82 |
text = text.replace(">", ">")
|
83 |
return text
|
84 |
|
|
|
|
|
|
|
85 |
|
86 |
def mask_with_protecto(text_for_prompt):
|
87 |
mask_request_url = "https://trial.protecto.ai/api/vault/mask"
|