Update external_api_engine_hf.py
Browse files
external_api_engine_hf.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
|
| 2 |
import requests
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
API_TOKEN = "YOUR_HUGGINGFACE_TOKEN"
|
| 6 |
API_URL = "https://api-inference.huggingface.co/models/rinna/japanese-gpt-neox-3.6b"
|
| 7 |
|
| 8 |
headers = {
|
|
@@ -28,4 +27,4 @@ def call_external_api(input_text):
|
|
| 28 |
else:
|
| 29 |
return "[API応答形式が不明です]"
|
| 30 |
except Exception as e:
|
| 31 |
-
return f"[Hugging Face APIエラー] {str(e)}"
|
|
|
|
|
|
|
| 1 |
import requests
|
| 2 |
+
import os # ← 環境変数の読み込みに必要
|
| 3 |
|
| 4 |
+
API_TOKEN = os.getenv("neko") # ← Secretsに登録した名前
|
|
|
|
| 5 |
API_URL = "https://api-inference.huggingface.co/models/rinna/japanese-gpt-neox-3.6b"
|
| 6 |
|
| 7 |
headers = {
|
|
|
|
| 27 |
else:
|
| 28 |
return "[API応答形式が不明です]"
|
| 29 |
except Exception as e:
|
| 30 |
+
return f"[Hugging Face APIエラー] {str(e)}"
|