Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,15 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
import torch
|
|
|
4 |
|
5 |
-
# Hugging Face
|
6 |
-
HUGGINGFACE_TOKEN = "
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Function to load model and tokenizer (local or Hugging Face with token)
|
9 |
def load_model(model_path):
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
import torch
|
4 |
+
import os
|
5 |
|
6 |
+
# Retrieve the Hugging Face token from environment variable
|
7 |
+
HUGGINGFACE_TOKEN = os.getenv("HF_ACCESS_TOKEN")
|
8 |
+
|
9 |
+
# Check if the token is available
|
10 |
+
if not HUGGINGFACE_TOKEN:
|
11 |
+
st.error("Hugging Face token not found. Please set the HUGGINGFACE_TOKEN environment variable.")
|
12 |
+
st.stop() # Stop the app if the token is not found
|
13 |
|
14 |
# Function to load model and tokenizer (local or Hugging Face with token)
|
15 |
def load_model(model_path):
|