Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,38 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import AutoTokenizer
|
3 |
-
import timm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
description = """
|
7 |
-
The LLM was finetuned on a Financial News Tweet Sentiment Dataset. The documents have 3 different labels:
|
8 |
-
"LABEL_0": "Bearish",
|
9 |
-
"LABEL_1": "Bullish",
|
10 |
-
"LABEL_2": "Neutral"
|
11 |
-
<img src="https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png" width=200px>
|
12 |
-
"""
|
13 |
|
14 |
-
article = "Check out the dataset that [BERT cased]((https://huggingface.co/bert-base-cased?text=Paris+is+the+%5BMASK%5D+of+France.)) was [finetuned on](https://huggingface.co/datasets/zeroshot/twitter-financial-news-sentiment/viewer/zeroshot--twitter-financial-news-sentiment/train?row=9505)."
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
gr.Interface(
|
26 |
-
fn=sentiment_analyzer,
|
27 |
-
inputs="textbox",
|
28 |
-
outputs="text",
|
29 |
-
title=title,
|
30 |
-
description=description,
|
31 |
-
article=article,
|
32 |
-
examples=[["CLNE, TRXC, TGE and ADMS among midday movers"],
|
33 |
-
["CRISPR Therapeutics among healthcare gainers; Plus Therapeutics leads the losers"]],
|
34 |
-
).launch()
|
|
|
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 = """
|
7 |
+
# The LLM was finetuned on a Financial News Tweet Sentiment Dataset. The documents have 3 different labels:
|
8 |
+
# "LABEL_0": "Bearish",
|
9 |
+
# "LABEL_1": "Bullish",
|
10 |
+
# "LABEL_2": "Neutral"
|
11 |
+
# <img src="https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png" width=200px>
|
12 |
+
# """
|
13 |
|
14 |
+
# article = "Check out the dataset that [BERT cased]((https://huggingface.co/bert-base-cased?text=Paris+is+the+%5BMASK%5D+of+France.)) was [finetuned on](https://huggingface.co/datasets/zeroshot/twitter-financial-news-sentiment/viewer/zeroshot--twitter-financial-news-sentiment/train?row=9505)."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
24 |
|
25 |
+
# gr.Interface(
|
26 |
+
# fn=sentiment_analyzer,
|
27 |
+
# inputs="textbox",
|
28 |
+
# outputs="text",
|
29 |
+
# title=title,
|
30 |
+
# description=description,
|
31 |
+
# article=article,
|
32 |
+
# examples=[["CLNE, TRXC, TGE and ADMS among midday movers"],
|
33 |
+
# ["CRISPR Therapeutics among healthcare gainers; Plus Therapeutics leads the losers"]],
|
34 |
+
# ).launch()
|
35 |
+
|
36 |
+
import gradio as gr
|
37 |
|
38 |
+
gr.Interface.load("models/at2507/zeroshot_finetuned_sentiment").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|