YaserDS-777 commited on
Commit
cdc1fda
1 Parent(s): 7696cf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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
- # Initialize the text generation pipeline
8
- pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3.1-405B")
 
 
 
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):