Update README to update default and add more examples.
This commit is contained in:
+74
-3
@@ -38,10 +38,10 @@ enviroment variables
|
||||
|
||||
- ``PORT`` - server's port (default: 8000)
|
||||
- ``MODEL_NAME`` - model name HuggingFace (default: knowledgator/gliner-multitask-large-v0.5)
|
||||
- ``MAX_TEXT_LENGTH`` - maximum text length (default: 10000)
|
||||
- ``MAX_TEXT_LENGTH`` - maximum text length (default: 1000)
|
||||
|
||||
API Endpoints
|
||||
-------------
|
||||
API Endpoints Examples
|
||||
----------------------
|
||||
|
||||
1. ``/general`` - Named Entity Recognition
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -73,6 +73,22 @@ API Endpoints
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Batch request with `prompt`:**
|
||||
|
||||
.. code:: json
|
||||
|
||||
curl -X POST http://localhost:8000/general \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"texts": [
|
||||
"Apple Inc. was founded by Steve Jobs in California.",
|
||||
"Microsoft is located in Redmond, Washington."
|
||||
],
|
||||
"entities": ["organization", "person", "location"],
|
||||
"prompt": "Identify organizations, people, and places from the text.",
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Response:**
|
||||
|
||||
.. code:: json
|
||||
@@ -127,6 +143,22 @@ API Endpoints
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Batch request with prompt:**
|
||||
|
||||
.. code:: bash
|
||||
|
||||
curl -X POST http://localhost:8000/relation-extraction \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"texts": [
|
||||
"Steve Jobs founded Apple Inc. in California.",
|
||||
"Bill Gates leads Microsoft."
|
||||
],
|
||||
"relations": ["founded_by", "leads"],
|
||||
"prompt": "Extract the relationships between the entities.",
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Response:**
|
||||
|
||||
.. code:: json
|
||||
@@ -182,6 +214,45 @@ API Endpoints
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Single request with `prompt`:**
|
||||
|
||||
.. code:: bash
|
||||
|
||||
curl -X POST http://localhost:8000/summarization \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"text": "Artificial intelligence is transforming industries worldwide. Machine learning enables computers to learn from data. Deep learning uses neural networks for complex tasks.",
|
||||
"prompt": "Generate a concise summary of the key concepts.",
|
||||
"threshold": 0.5
|
||||
}'
|
||||
|
||||
**Response:**
|
||||
|
||||
.. code:: json
|
||||
|
||||
{
|
||||
"outputs": [
|
||||
{
|
||||
"text": "Artificial intelligence is transforming industries worldwide.",
|
||||
"start": 0,
|
||||
"end": 61,
|
||||
"score": 0.8586996793746948
|
||||
},
|
||||
{
|
||||
"text": "Machine learning enables computers to learn from data.",
|
||||
"start": 62,
|
||||
"end": 116,
|
||||
"score": 0.9330101013183594
|
||||
},
|
||||
{
|
||||
"text": "Deep learning uses neural networks for complex tasks.",
|
||||
"start": 117,
|
||||
"end": 170,
|
||||
"score": 0.8803190588951111
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Error handling
|
||||
--------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user