mehran-sarmadi commited on
Commit
07eae29
·
verified ·
1 Parent(s): 7a06500

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -2
README.md CHANGED
@@ -55,11 +55,76 @@ For more detailed information on the dataset creation and curation process, plea
55
  | Tooka-SBERT | 60.65 | 59.40 | 56.45 | 87.04 | 58.29 | 27.86 | 76.42 | 59.06 |
56
 
57
  ---
 
58
 
59
- ## 🔧 Usage Example
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  ```python
62
- Access to the Hakim model will be available through an API. This section will be updated with usage instructions and examples once the API is ready.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ```
64
 
65
  ## Citation
 
55
  | Tooka-SBERT | 60.65 | 59.40 | 56.45 | 87.04 | 58.29 | 27.86 | 76.42 | 59.06 |
56
 
57
  ---
58
+ ## Model Usage
59
 
60
+ You can interact with the `Hakim_small` model through our API. Below are examples using `curl` and Python.
61
+
62
+ ### Inference with `curl`
63
+
64
+ Here's how to send a request to the model using a `curl` command in your terminal.
65
+
66
+ **Important:** Replace `your_api_key` with your actual API key.
67
+
68
+ > **Note:** For quick testing, you can use the value `mcinext` as your API key. This will allow you to use the API with some limitations.
69
+
70
+ ```bash
71
+ curl -X POST 'https://mcinext.ai/api/hakim-small' \
72
+ -H "Content-Type: application/json" \
73
+ -H "Accept: application/json" \
74
+ -H "Authorization": "Bearer your_api_key" \
75
+ -d '{
76
+ "model": "Hakim_small",
77
+ "input": [
78
+ "The text of the first document.",
79
+ "The text of the second document.",
80
+ "And so on..."
81
+ ],
82
+ "encoding_format": "float",
83
+ "add_special_tokens": true
84
+ }'
85
+ ```
86
+ ### Inference with `python`
87
 
88
  ```python
89
+ import requests
90
+ import json
91
+
92
+ # --- Configuration ---
93
+ API_KEY = "your_api_key" # Replace with your key or "mcinext" for testing
94
+ API_URL = "https://mcinext.ai/api/hakim-small"
95
+
96
+ # --- Request Details ---
97
+ headers = {
98
+ "Content-Type": "application/json",
99
+ "Accept": "application/json",
100
+ "Authorization": f"Bearer {API_KEY}"
101
+ }
102
+
103
+ data = {
104
+ "model": "Hakim_small",
105
+ "input": [
106
+ "The text of the first document.",
107
+ "The text of the second document.",
108
+ "And so on..."
109
+ ],
110
+ "encoding_format": "float",
111
+ "add_special_tokens": True
112
+ }
113
+
114
+ # --- Send Request ---
115
+ try:
116
+ response = requests.post(API_URL, headers=headers, data=json.dumps(data))
117
+ response.raise_for_status()
118
+
119
+ print("Request successful!")
120
+ print("Response JSON:")
121
+ print(response.json())
122
+
123
+ except requests.exceptions.HTTPError as http_err:
124
+ print(f"HTTP error occurred: {http_err}")
125
+ print(f"Response content: {response.text}")
126
+ except Exception as err:
127
+ print(f"An other error occurred: {err}")
128
  ```
129
 
130
  ## Citation