Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,15 @@ import matplotlib.pyplot as plt
|
|
6 |
from transformers import MarianMTModel, MarianTokenizer, pipeline
|
7 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
import gradio as gr
|
|
|
9 |
|
10 |
# Constants for model names and API URLs
|
11 |
class Constants:
|
12 |
TRANSLATION_MODEL_NAME = "Helsinki-NLP/opus-mt-mul-en"
|
13 |
IMAGE_GENERATION_API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
14 |
GPT_NEO_MODEL_NAME = "EleutherAI/gpt-neo-125M"
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
# Translation Class
|
20 |
class Translator:
|
|
|
6 |
from transformers import MarianMTModel, MarianTokenizer, pipeline
|
7 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
import gradio as gr
|
9 |
+
import os # For accessing environment variables
|
10 |
|
11 |
# Constants for model names and API URLs
|
12 |
class Constants:
|
13 |
TRANSLATION_MODEL_NAME = "Helsinki-NLP/opus-mt-mul-en"
|
14 |
IMAGE_GENERATION_API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
15 |
GPT_NEO_MODEL_NAME = "EleutherAI/gpt-neo-125M"
|
16 |
+
# Get the Hugging Face API token from environment variables
|
17 |
+
HEADERS = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
|
|
|
18 |
|
19 |
# Translation Class
|
20 |
class Translator:
|