-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from privateai/restore-process-file-uri-py
Restore process_file_uri.py
- Loading branch information
Showing
3 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Example script to illustrate how to make API calls to the Private AI API | ||
# to deidentify a provided file via local file URI. | ||
|
||
from privateai_client import PAIClient | ||
from privateai_client.objects import request_objects | ||
|
||
input_file = "examples/data/PAI_SYNTH_EN_medical-referral_2.pdf" | ||
|
||
client = PAIClient("http", "localhost", "8080") | ||
|
||
req_obj = request_objects.file_uri_obj(uri=input_file) | ||
# NOTE this method of file processing requires the container to have an the input and output directories mounted | ||
resp = client.process_files_uri(req_obj) | ||
if resp.ok: | ||
print(f"File redaction completed: {resp.result_uri}") | ||
else: | ||
print(f"response for file {input_file} returned with {resp.status_code}") | ||
|