From 36bffe4cd045bf542af70a9ab488aef0377fe673 Mon Sep 17 00:00:00 2001 From: Rishiraj Acharya <44090649+rishiraj@users.noreply.github.com> Date: Mon, 27 May 2024 02:03:47 +0530 Subject: [PATCH] add file links and note about wait_for_extraction --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b638c1ce2..935c9fc08 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,13 @@ client.create_extraction_graph(extraction_graph) #### Upload an Audio ```python -content_id = client.upload_file("audiosummary", "file.mp3") +with open("sample.mp3", 'wb') as file: + file.write((requests.get("https://extractor-files.diptanu-6d5.workers.dev/sample-000009.mp3")).content) +content_id = client.upload_file("audiosummary", "sample.mp3") ``` + Adding Texts and Files can be a time consuming process and by default we allow asynchronous ingestion for parallel operations. However the following codes might fail until the extraction has been completed. To make it a blocking call, use 'client.wait_for_extraction(content_id)' after getting the content_id from above. + #### Retrieve Summary ```python client.get_extracted_content(content_id) @@ -148,7 +152,9 @@ client.create_extraction_graph(extraction_graph) #### Upload Images ```python -content_id = client.upload_file("imageknowledgebase", "file.jpg") +with open("sample.jpg", 'wb') as file: + file.write((requests.get("https://extractor-files.diptanu-6d5.workers.dev/people-standing.jpg")).content) +content_id = client.upload_file("imageknowledgebase", "sample.jpg") ``` #### Retrieve Features of an Image @@ -183,7 +189,9 @@ client.create_extraction_graph(extraction_graph) #### Upload a Document ```python -content_id = client.upload_file("pdfqa", "file.pdf") +with open("sample.pdf", 'wb') as file: + file.write((requests.get("https://extractor-files.diptanu-6d5.workers.dev/scientific-paper-example.pdf")).content) +content_id = client.upload_file("pdfqa", "sample.pdf") ``` #### Get Text, Image and Tables