mirror of
https://github.com/hexastack/hexabot
synced 2025-05-09 15:10:57 +00:00
Merge pull request #356 from Hexastack/feat/huggingface-authentication
Add HuggingFace login functionality
This commit is contained in:
commit
c77aabb269
@ -64,3 +64,6 @@ APP_REDIS_PORT=9001
|
|||||||
REDIS_ENABLED=false
|
REDIS_ENABLED=false
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
# Huggingface Access token
|
||||||
|
HF_AUTH_TOKEN=
|
||||||
|
@ -7,6 +7,7 @@ import boilerplate as tfbp
|
|||||||
from fastapi import Depends, FastAPI, HTTPException, status
|
from fastapi import Depends, FastAPI, HTTPException, status
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
import logging
|
import logging
|
||||||
|
from huggingface_hub import login
|
||||||
|
|
||||||
# Set up logging configuration
|
# Set up logging configuration
|
||||||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
@ -17,6 +18,11 @@ AVAILABLE_LANGUAGES = os.getenv("AVAILABLE_LANGUAGES", "en,fr").split(',')
|
|||||||
TFLC_REPO_ID = os.getenv("TFLC_REPO_ID")
|
TFLC_REPO_ID = os.getenv("TFLC_REPO_ID")
|
||||||
INTENT_CLASSIFIER_REPO_ID = os.getenv("INTENT_CLASSIFIER_REPO_ID")
|
INTENT_CLASSIFIER_REPO_ID = os.getenv("INTENT_CLASSIFIER_REPO_ID")
|
||||||
SLOT_FILLER_REPO_ID = os.getenv("SLOT_FILLER_REPO_ID")
|
SLOT_FILLER_REPO_ID = os.getenv("SLOT_FILLER_REPO_ID")
|
||||||
|
HF_AUTH_TOKEN = os.getenv("HF_AUTH_TOKEN")
|
||||||
|
|
||||||
|
# Log in to HuggingFace using the provided access token
|
||||||
|
if HF_AUTH_TOKEN:
|
||||||
|
login(token=HF_AUTH_TOKEN)
|
||||||
|
|
||||||
def load_language_classifier():
|
def load_language_classifier():
|
||||||
# Init language classifier model
|
# Init language classifier model
|
||||||
|
Loading…
Reference in New Issue
Block a user