mehran-sarmadi commited on
Commit
5be72ed
·
verified ·
1 Parent(s): df19bf9

Update README.md

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