Commit ·
992e802
1
Parent(s): b644449
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,6 +39,7 @@ def generate(
|
|
| 39 |
repetition_penalty: float = 1.2,
|
| 40 |
) -> Iterator[str]:
|
| 41 |
conversation = []
|
|
|
|
| 42 |
if system_prompt:
|
| 43 |
conversation.append({"role": "system", "content": system_prompt})
|
| 44 |
for user, assistant in chat_history:
|
|
@@ -69,8 +70,15 @@ def generate(
|
|
| 69 |
outputs = []
|
| 70 |
for text in streamer:
|
| 71 |
outputs.append(text)
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
chat_interface = gr.ChatInterface(
|
| 76 |
fn=generate,
|
|
|
|
| 39 |
repetition_penalty: float = 1.2,
|
| 40 |
) -> Iterator[str]:
|
| 41 |
conversation = []
|
| 42 |
+
|
| 43 |
if system_prompt:
|
| 44 |
conversation.append({"role": "system", "content": system_prompt})
|
| 45 |
for user, assistant in chat_history:
|
|
|
|
| 70 |
outputs = []
|
| 71 |
for text in streamer:
|
| 72 |
outputs.append(text)
|
| 73 |
+
# Mask the output here
|
| 74 |
+
masked_output = mask_with_protecto("".join(outputs))
|
| 75 |
+
# yield "".join(outputs)
|
| 76 |
+
yield masked_output
|
| 77 |
+
|
| 78 |
|
| 79 |
+
def mask_with_protecto(msg_to_mask):
|
| 80 |
+
return(msg_to_mask)
|
| 81 |
+
|
| 82 |
|
| 83 |
chat_interface = gr.ChatInterface(
|
| 84 |
fn=generate,
|