at2507 commited on
Commit
7dc5723
·
1 Parent(s): 72da43d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,9 +1,6 @@
1
- # import gradio as gr
2
-
3
- # gr.Interface.load("models/at2507/zeroshot_finetuned_sentiment").launch()
4
-
5
  import gradio as gr
6
  from transformers import AutoTokenizer
 
7
 
8
  title = "Finetuning [BERT] on A Financial News Sentiment Dataset"
9
  description = """
@@ -18,7 +15,9 @@ article = "Check out the dataset that [BERT cased]((https://huggingface.co/bert-
18
 
19
 
20
  def sentiment_analyzer(tweet):
21
- model = model.load("models/at2507/zeroshot_finetuned_sentiment")
 
 
22
  tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
23
  zeroshotsent_model = pipeline("text-classification", model = model.to('cpu:0'), tokenizer=tokenizer)
24
  return zeroshotsent_model(tweet)
@@ -33,4 +32,3 @@ gr.Interface(
33
  examples=[["CLNE, TRXC, TGE and ADMS among midday movers"],
34
  ["CRISPR Therapeutics among healthcare gainers; Plus Therapeutics leads the losers"]],
35
  ).launch()
36
-
 
 
 
 
 
1
  import gradio as gr
2
  from transformers import AutoTokenizer
3
+ import timm
4
 
5
  title = "Finetuning [BERT] on A Financial News Sentiment Dataset"
6
  description = """
 
15
 
16
 
17
  def sentiment_analyzer(tweet):
18
+ model_reloaded = timm.create_model('hf_hub:at2507/zeroshot_finetuned_sentiment', pretrained=True)
19
+ # model = model.load("models/at2507/zeroshot_finetuned_sentiment")
20
+ # gr.Interface.load("models/at2507/zeroshot_finetuned_sentiment").launch()
21
  tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
22
  zeroshotsent_model = pipeline("text-classification", model = model.to('cpu:0'), tokenizer=tokenizer)
23
  return zeroshotsent_model(tweet)
 
32
  examples=[["CLNE, TRXC, TGE and ADMS among midday movers"],
33
  ["CRISPR Therapeutics among healthcare gainers; Plus Therapeutics leads the losers"]],
34
  ).launch()