Commit
·
cfb1781
1
Parent(s):
dd64744
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,6 +73,7 @@ def generate(
|
|
| 73 |
outputs.append(text)
|
| 74 |
# Mask the output here
|
| 75 |
masked_output = mask_with_protecto("".join(outputs))
|
|
|
|
| 76 |
# yield "".join(outputs)
|
| 77 |
yield masked_output
|
| 78 |
|
|
@@ -92,14 +93,14 @@ def mask_with_protecto(text_for_prompt):
|
|
| 92 |
}
|
| 93 |
response = requests.put(mask_request_url, headers=headers, json=mask_input)
|
| 94 |
if response.status_code == 200:
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
| 99 |
else:
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
print(response.text)
|
| 103 |
|
| 104 |
chat_interface = gr.ChatInterface(
|
| 105 |
fn=generate,
|
|
|
|
| 73 |
outputs.append(text)
|
| 74 |
# Mask the output here
|
| 75 |
masked_output = mask_with_protecto("".join(outputs))
|
| 76 |
+
masked_output = "I will print whatever I want to"
|
| 77 |
# yield "".join(outputs)
|
| 78 |
yield masked_output
|
| 79 |
|
|
|
|
| 93 |
}
|
| 94 |
response = requests.put(mask_request_url, headers=headers, json=mask_input)
|
| 95 |
if response.status_code == 200:
|
| 96 |
+
# Parse the masked result from the API response and format it for display
|
| 97 |
+
masked_result = response.json()
|
| 98 |
+
final_result = json.dumps(masked_result, indent=4)
|
| 99 |
+
#return(masked_result["data"][0]["token_value"])
|
| 100 |
+
return(final_result)
|
| 101 |
else:
|
| 102 |
+
# Return an error message if the API request was not successful.
|
| 103 |
+
return(str(response.status_code))
|
|
|
|
| 104 |
|
| 105 |
chat_interface = gr.ChatInterface(
|
| 106 |
fn=generate,
|