app.py
CHANGED
|
@@ -3,6 +3,7 @@ import requests
|
|
| 3 |
|
| 4 |
# GPT-J-6B API
|
| 5 |
API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
|
|
|
|
| 6 |
prompt = """
|
| 7 |
word: risk
|
| 8 |
poem using word: And then the day came,
|
|
@@ -37,7 +38,7 @@ def poem_generate(word):
|
|
| 37 |
"max_new_tokens": 50,
|
| 38 |
"return_full_text": False
|
| 39 |
}}
|
| 40 |
-
response = requests.post(API_URL, json=json_)
|
| 41 |
output = response.json()
|
| 42 |
print(f"Was there an error? Reason is : {output}")
|
| 43 |
output_tmp = output[0]['generated_text']
|
|
|
|
| 3 |
|
| 4 |
# GPT-J-6B API
|
| 5 |
API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-j-6B"
|
| 6 |
+
headers = {"Authorization": "Bearer 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"}
|
| 7 |
prompt = """
|
| 8 |
word: risk
|
| 9 |
poem using word: And then the day came,
|
|
|
|
| 38 |
"max_new_tokens": 50,
|
| 39 |
"return_full_text": False
|
| 40 |
}}
|
| 41 |
+
response = requests.post(API_URL, headers=headers, json=json_)
|
| 42 |
output = response.json()
|
| 43 |
print(f"Was there an error? Reason is : {output}")
|
| 44 |
output_tmp = output[0]['generated_text']
|