Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,17 +2,13 @@ import streamlit as st
|
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import torch
|
| 4 |
import os
|
| 5 |
-
from dotenv import load_dotenv
|
| 6 |
-
|
| 7 |
-
# Load environment variables from .env file
|
| 8 |
-
load_dotenv()
|
| 9 |
|
| 10 |
@st.cache_resource
|
| 11 |
def load_pipeline():
|
| 12 |
# Get the token from the environment variable
|
| 13 |
-
token = os.
|
| 14 |
if not token:
|
| 15 |
-
st.error("Hugging Face token not found. Please check your
|
| 16 |
st.stop()
|
| 17 |
|
| 18 |
pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", use_auth_token=token)
|
|
|
|
| 2 |
from diffusers import DiffusionPipeline
|
| 3 |
import torch
|
| 4 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
@st.cache_resource
|
| 7 |
def load_pipeline():
|
| 8 |
# Get the token from the environment variable
|
| 9 |
+
token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
| 10 |
if not token:
|
| 11 |
+
st.error("Hugging Face token not found. Please check your Hugging Face Spaces secrets.")
|
| 12 |
st.stop()
|
| 13 |
|
| 14 |
pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", use_auth_token=token)
|