MariyaBenny commited on
Commit
bd54678
·
verified ·
1 Parent(s): 6051435

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,9 +1,16 @@
1
  import streamlit as st
2
- from transformers import pipeline
3
 
4
- pipe = pipeline('sentiment-analysis')
 
 
 
 
 
 
5
  text = st.text_area("Enter your text:")
6
 
7
  if text:
 
8
  out = pipe(text)
9
- st.json(out)
 
1
  import streamlit as st
2
+ from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
3
 
4
+ # Load tokenizer and model from Hugging Face model hub
5
+ model_name = "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode"
6
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
7
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
+
9
+ # Define the pipeline using the loaded tokenizer and model
10
+ pipe = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
11
  text = st.text_area("Enter your text:")
12
 
13
  if text:
14
+ # Perform sentiment analysis using the pipeline
15
  out = pipe(text)
16
+ st.json(out)