Kaludi commited on
Commit
c804c6f
1 Parent(s): 4869828

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -7,7 +7,7 @@ import transformers
7
  from transformers import AutoTokenizer, AutoConfig,AutoModelForSequenceClassification,TFAutoModelForSequenceClassification
8
  from scipy.special import softmax
9
  # Requirements
10
- model_path = "Kaludi/Reviews-Sentiment-Analysis"
11
  tokenizer = AutoTokenizer.from_pretrained(model_path)
12
  config = AutoConfig.from_pretrained(model_path)
13
  model = AutoModelForSequenceClassification.from_pretrained(model_path)
@@ -31,7 +31,7 @@ def sentiment_analysis(text):
31
  scores_ = softmax(scores_)
32
 
33
  # Format output dict of scores
34
- labels = ["Negative", "Positive"]
35
  scores = {l:float(s) for (l,s) in zip(labels, scores_) }
36
 
37
  return scores
@@ -39,13 +39,27 @@ def sentiment_analysis(text):
39
 
40
  # ---- Gradio app interface
41
  app = gr.Interface(fn = sentiment_analysis,
42
- inputs = gr.Textbox("Write your text or review here..."),
43
  outputs = "label",
44
- title = "Sentiment Analysis of Customer Reviews",
45
- description = "A tool that analyzes the overall sentiment of customer reviews for a specific product or service, whether it's positive or negative. This analysis is performed by using natural language processing algorithms and machine learning from the model 'Reviews-Sentiment-Analysis' trained by Kaludi, allowing businesses to gain valuable insights into customer satisfaction and improve their products and services accordingly.",
46
  article = "<p style='text-align: center'><a href='https://github.com/Kaludii'>Github</a> | <a href='https://huggingface.co/Kaludi'>HuggingFace</a></p>",
47
  interpretation = "default",
48
- examples = [["I was extremely disappointed with this product. The quality was terrible and it broke after only a few days of use. Customer service was unhelpful and unresponsive. I would not recommend this product to anyone."],[ "I am so impressed with this product! The quality is outstanding and it has exceeded all of my expectations. The customer service team was also incredibly helpful and responsive to any questions I had. I highly recommend this product to anyone in need of a top-notch, reliable solution."],["I don't feel like you trust me to do my job."],["This service was honestly one of the best I've experienced, I'll definitely come back!"]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  )
50
 
51
  app.launch()
 
7
  from transformers import AutoTokenizer, AutoConfig,AutoModelForSequenceClassification,TFAutoModelForSequenceClassification
8
  from scipy.special import softmax
9
  # Requirements
10
+ model_path = "Kaludi/BDA594-fake-news-classification"
11
  tokenizer = AutoTokenizer.from_pretrained(model_path)
12
  config = AutoConfig.from_pretrained(model_path)
13
  model = AutoModelForSequenceClassification.from_pretrained(model_path)
 
31
  scores_ = softmax(scores_)
32
 
33
  # Format output dict of scores
34
+ labels = ["Fake", "Real"]
35
  scores = {l:float(s) for (l,s) in zip(labels, scores_) }
36
 
37
  return scores
 
39
 
40
  # ---- Gradio app interface
41
  app = gr.Interface(fn = sentiment_analysis,
42
+ inputs = gr.Textbox("Write your text or news article here..."),
43
  outputs = "label",
44
+ title = "BDA594 Fake News Classification",
45
+ description = "This is a Food Category Image Classifier model that has been trained by [Kaludi](https://huggingface.co/Kaludi) to determine the authenticity of news articles. It classifies articles into two categories: **Real** and **Fake**. By analyzing the content and context of a given article, this model can accurately determine whether the news is genuine or fabricated.",
46
  article = "<p style='text-align: center'><a href='https://github.com/Kaludii'>Github</a> | <a href='https://huggingface.co/Kaludi'>HuggingFace</a></p>",
47
  interpretation = "default",
48
+ examples = [["WASHINGTON—Noting that there was no excuse for the first dog’s most recent instance of bad behavior, the White House confirmed Thursday that Commander Biden had gnawed the Washington Monument down to a slobber-covered stub. “We turn our backs for two minutes, and boom, we find Commander sitting there on the National Mall with the entire Washington Monument in his mouth,” said White House aide Paul Stephens, adding that no matter how much they attempted to distract the dog with treats, tried to pry his mouth open with their hands, or yelled “Drop it,” the 2-year-old German shepherd continued to growl and bite enormous chunks of cement off the 555-foot tall obelisk. “While we love Commander, we cannot continue to allow him to misbehave, especially after he took what remained of the monument and tried to hide it under a rug in the West Wing. This is almost as bad as when he tore apart the Lincoln Memorial in search of a squeaker. We will not let this happen again.” At press time, sources confirmed Commander Biden had a bad case of the runs and was defecating chunks of cement all over the Reflecting Pool."],[ "WASHINGTON Rep. Jim Jordan said Thursday that he has spoken about his bid to be the next speaker of the House with Donald Trump and that he would not support ousting Rep. Matt Gaetz from the Republican caucus even amid anger from some lawmakers after he led Kevin McCarthy's removal.
49
+
50
+ “I talked to the president about this and all kinds of issues,” Jordan, R-Ohio, a staunch ally of the former president, said in an interview Thursday. Asked whether Trump supports his bid for speaker, Jordan said: “I don’t want to say anything, but I had a great conversation with the president.”
51
+
52
+ Follow live coverage of the speaker race on NBCNews.com.
53
+
54
+ Jordan also said he would not support efforts to oust Gaetz, R-Fla., from the Republican Conference, a possibility that has been floated by House members who are angry that Gaetz worked to remove McCarthy, R-Calif., from the speaker’s post.
55
+
56
+ “I don’t think that’s warranted,” Jordan said. “We’ve got a four-seat majority; Matt’s a talented member of Congress. I disagree with what he did … but he’s a great member of our committee. … I think we’ve got to come together.”
57
+
58
+ Asked whether one member should be able to make a motion to remove a speaker — the rule that was used to get McCarthy out of the leadership role in a historic vote this week — Jordan demurred on the importance of changing it.
59
+
60
+ “That’s a conference decision,” he said. “But I’ll tell you what, if that’s what the conference wants to do, then I would support it.”
61
+
62
+ Procedurally, Jordan pointed out, changing House rules would need a majority vote. “The question comes is you’ve got to have all of us on board for that. … I wouldn’t go to Democrats and get votes, because they’re going to want something.”"],["I don't feel like you trust me to do my job."],["This service was honestly one of the best I've experienced, I'll definitely come back!"]]
63
  )
64
 
65
  app.launch()