Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ tokenizer = BertTokenizer.from_pretrained('ProsusAI/finbert')
|
|
8 |
# Load pre-trained model
|
9 |
model = BertForSequenceClassification.from_pretrained('ProsusAI/finbert')
|
10 |
|
11 |
-
def get_sentiment(
|
12 |
# Encode the text
|
13 |
tokens = tokenizer.encode_plus(sec_text, add_special_tokens=True, return_tensors="pt")
|
14 |
|
@@ -24,21 +24,13 @@ def get_sentiment(sec_text): # Ensure the parameter name matches the placeholde
|
|
24 |
# Return the sentiment analysis result
|
25 |
return f"{sentiment} Sentiment"
|
26 |
|
27 |
-
# Custom CSS to center the title
|
28 |
-
custom_css = """
|
29 |
-
.title {
|
30 |
-
text-align: center;
|
31 |
-
}
|
32 |
-
"""
|
33 |
-
|
34 |
# Define the Gradio interface
|
35 |
gr_interface = gr.Interface(
|
36 |
fn=get_sentiment,
|
37 |
inputs=gr.Textbox(lines=1, placeholder=""),
|
38 |
outputs="text",
|
39 |
-
title="Sentiment Analysis"
|
40 |
-
css=custom_css # Add the custom CSS to the Interface
|
41 |
)
|
42 |
|
43 |
# Launch the interface
|
44 |
-
gr_interface.launch()
|
|
|
8 |
# Load pre-trained model
|
9 |
model = BertForSequenceClassification.from_pretrained('ProsusAI/finbert')
|
10 |
|
11 |
+
def get_sentiment(입력):
|
12 |
# Encode the text
|
13 |
tokens = tokenizer.encode_plus(sec_text, add_special_tokens=True, return_tensors="pt")
|
14 |
|
|
|
24 |
# Return the sentiment analysis result
|
25 |
return f"{sentiment} Sentiment"
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
# Define the Gradio interface
|
28 |
gr_interface = gr.Interface(
|
29 |
fn=get_sentiment,
|
30 |
inputs=gr.Textbox(lines=1, placeholder=""),
|
31 |
outputs="text",
|
32 |
+
title="Sentiment Analysis"
|
|
|
33 |
)
|
34 |
|
35 |
# Launch the interface
|
36 |
+
gr_interface.launch()
|