JuanPablo4to commited on
Commit
d22aa3e
·
verified ·
1 Parent(s): c897f8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  import os
3
- from transformers import pipeline
4
  from huggingface_hub import login
5
 
6
  # Read the Hugging Face API token from the environment variable
@@ -14,8 +14,8 @@ login(token=api_token)
14
 
15
  model_id = "meta-llama/Meta-Llama-3-8B"
16
 
17
- # Initialize the model pipeline
18
- pipe = pipeline("text-generation", model=model_id)
19
 
20
  # Display the logo and title
21
  st.image("logo.jpg", width=300)
@@ -49,3 +49,4 @@ if user_input:
49
 
50
  # Display the AI's response
51
  st.write(ai_response)
 
 
1
  import streamlit as st
2
  import os
3
+ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
4
  from huggingface_hub import login
5
 
6
  # Read the Hugging Face API token from the environment variable
 
14
 
15
  model_id = "meta-llama/Meta-Llama-3-8B"
16
 
17
+ # Initialize the model pipeline with authentication
18
+ pipe = pipeline("text-generation", model=model_id, use_auth_token=api_token)
19
 
20
  # Display the logo and title
21
  st.image("logo.jpg", width=300)
 
49
 
50
  # Display the AI's response
51
  st.write(ai_response)
52
+