mehran-sarmadi commited on
Commit
47713ba
·
verified ·
1 Parent(s): 0f33777

Update README.md

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