mbabazif
commited on
Commit
•
acdfef5
1
Parent(s):
1c790d0
Gradio Aplication
Browse files
app.py
CHANGED
@@ -1,11 +1,5 @@
|
|
1 |
-
from transformers import
|
2 |
-
from transformers import TFAutoModelForSequenceClassification
|
3 |
-
from transformers import AutoTokenizer, AutoConfig
|
4 |
-
import numpy as np
|
5 |
import gradio as gr
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
10 |
|
11 |
# Specifying the model path, which points to the Hugging Face Model Hub
|
@@ -13,7 +7,6 @@ model_path = f'Mbabazi/cardiffnlp_twitter_roberta_base_sentiment_latest_Nov2023'
|
|
13 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
14 |
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
15 |
|
16 |
-
|
17 |
# Function to predict sentiment of a given tweet
|
18 |
def predict_tweet(tweet):
|
19 |
# Tokenize the input tweet using the specified tokenizer
|
@@ -47,6 +40,6 @@ iface = gr.Interface(
|
|
47 |
)
|
48 |
|
49 |
|
50 |
-
iface.launch()
|
51 |
|
52 |
# with gr.Blocks() as demo:
|
|
|
1 |
+
from transformers import AutoTokenizer
|
|
|
|
|
|
|
2 |
import gradio as gr
|
|
|
|
|
|
|
3 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
4 |
|
5 |
# Specifying the model path, which points to the Hugging Face Model Hub
|
|
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
8 |
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
9 |
|
|
|
10 |
# Function to predict sentiment of a given tweet
|
11 |
def predict_tweet(tweet):
|
12 |
# Tokenize the input tweet using the specified tokenizer
|
|
|
40 |
)
|
41 |
|
42 |
|
43 |
+
iface.launch(share=True)
|
44 |
|
45 |
# with gr.Blocks() as demo:
|