Update README.md
Browse files
README.md
CHANGED
@@ -19,28 +19,25 @@ datasets:
|
|
19 |
|
20 |
```python
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
device_map="auto",
|
30 |
-
torch_dtype='auto'
|
31 |
-
).eval()
|
32 |
|
33 |
-
# Prompt content: "Pẹlẹ o. Bawo ni o se wa?" ("Hello. How are you?")
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
41 |
-
|
42 |
-
# Model response:
|
43 |
-
print(response)
|
44 |
```
|
45 |
|
46 |
|
|
|
19 |
|
20 |
```python
|
21 |
|
22 |
+
import requests
|
23 |
|
24 |
+
API_URL = "https://i8nykns7vw253vx3.us-east-1.aws.endpoints.huggingface.cloud"
|
25 |
+
headers = {
|
26 |
+
"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
27 |
+
"Content-Type": "application/json"
|
28 |
+
}
|
29 |
|
30 |
+
def query(payload):
|
31 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
32 |
+
return response.json()
|
|
|
|
|
|
|
33 |
|
34 |
+
# Prompt content: "Pẹlẹ o. Bawo ni o se wa?" ("Hello. How are you?")
|
35 |
+
output = query({
|
36 |
+
"inputs": "Pẹlẹ o. Bawo ni o se wa?",
|
37 |
+
})
|
38 |
|
39 |
+
# Model response: "O dabo. O jẹ ọjọ ti o dara." ("I am safe. It was a good day.")
|
40 |
+
print(output)
|
|
|
|
|
|
|
|
|
41 |
```
|
42 |
|
43 |
|