Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import pipeline
|
| 5 |
-
HF_TOKEN = os.environ.get("llama3", None)
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Define the function to generate text
|
| 11 |
def generate_text(prompt):
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
|
|
|
| 4 |
|
| 5 |
+
# Get the Hugging Face API token from environment variables
|
| 6 |
+
api_token = os.getenv("HUGGINGFACE_API_TOKEN")
|
| 7 |
+
|
| 8 |
+
# Initialize the text generation pipeline with authentication
|
| 9 |
+
pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3.1-405B", use_auth_token=api_token)
|
| 10 |
|
| 11 |
# Define the function to generate text
|
| 12 |
def generate_text(prompt):
|