Update README.md
Browse files
README.md
CHANGED
|
@@ -37,14 +37,41 @@ Known Limitations: Cannot provide information in other languages and may h
|
|
| 37 |
License: [cc-by-nc-sa4.0]
|
| 38 |
Conditions of Use: The model is available for non-commercial and educational use. It is recommended to review the license terms.
|
| 39 |
|
| 40 |
-
##
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
from transformers import pipeline
|
| 46 |
|
| 47 |
-
|
| 48 |
-
generated_text = generator("Una vez en un lugar lejano, ", max_length=100, num_return_sequences=1)
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
License: [cc-by-nc-sa4.0]
|
| 38 |
Conditions of Use: The model is available for non-commercial and educational use. It is recommended to review the license terms.
|
| 39 |
|
| 40 |
+
## Example
|
| 41 |
|
| 42 |
+
Install request:
|
| 43 |
|
| 44 |
+
pip install requests
|
|
|
|
| 45 |
|
| 46 |
+
After that, put that in you python:
|
|
|
|
| 47 |
|
| 48 |
+
import requests
|
| 49 |
+
import json
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
model_name = 'Trat80/AdemGPT'
|
| 53 |
+
api_token = 'tu_api_token' # You token api
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
input_text = "Hi! My Name Is AdemGPT!"
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
headers = {
|
| 60 |
+
'Authorization': f'Bearer {api_token}',
|
| 61 |
+
'Content-Type': 'application/json'
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
data = {
|
| 65 |
+
'inputs': input_text,
|
| 66 |
+
'parameters': {
|
| 67 |
+
'max_new_tokens': 100
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
response = requests.post(f'https://api-inference.huggingface.co/models/{model_name}', headers=headers, data=json.dumps(data))
|
| 72 |
+
|
| 73 |
+
if response.status_code == 200:
|
| 74 |
+
generated_text = response.json().get('generated_text')
|
| 75 |
+
print(generated_text)
|
| 76 |
+
else:
|
| 77 |
+
print("Error en la solicitud:", response.status_code, response.text)
|