ikoghoemmanuell commited on
Commit
7047b28
·
1 Parent(s): 47a2e1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -2,23 +2,23 @@ import streamlit as st
2
  import transformers
3
  import torch
4
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
 
5
 
6
  # Load the model and tokenizer
7
  model_name = AutoModelForSequenceClassification.from_pretrained("ikoghoemmanuell/finetuned_fake_news_roberta")
8
  tokenizer_name = AutoTokenizer.from_pretrained("ikoghoemmanuell/finetuned_fake_news_roberta")
9
 
10
- # Define the function for detecting fake news
11
- @st.cache_resource
12
- def detect_fake_news(text):
13
- # Load the pipeline.
14
- pipeline = transformers.pipeline("text-classification", model=model_name, tokenizer=tokenizer_name)
15
 
16
- # Predict the sentiment.
17
- prediction = pipeline(text)
18
- sentiment = prediction[0]["label"]
19
- score = prediction[0]["score"]
 
 
 
20
 
21
- return sentiment, score
22
 
23
  # Setting the page configurations
24
  st.set_page_config(
 
2
  import transformers
3
  import torch
4
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
5
+ from predict_function import detect_fake_news
6
 
7
  # Load the model and tokenizer
8
  model_name = AutoModelForSequenceClassification.from_pretrained("ikoghoemmanuell/finetuned_fake_news_roberta")
9
  tokenizer_name = AutoTokenizer.from_pretrained("ikoghoemmanuell/finetuned_fake_news_roberta")
10
 
11
+ # # Set Page Configurations
12
+ # st.set_page_config(page_title="Fake News Detection App", page_icon="fas fa-exclamation-triangle", layout="wide", initial_sidebar_state="auto")
 
 
 
13
 
14
+ # # Loading GIF
15
+ # gif_url = "https://raw.githubusercontent.com/Gilbert-B/Forecasting-Sales/main/app/salesgif.gif"
16
+
17
+ # # Set up sidebar
18
+ # st.sidebar.header('Navigation')
19
+ # menu = ['Home', 'About']
20
+ # choice = st.sidebar.selectbox("Select an option", menu)
21
 
 
22
 
23
  # Setting the page configurations
24
  st.set_page_config(