Spaces:
Running
Running
abhyast123
commited on
Commit
•
4d2cfaf
1
Parent(s):
0e7113f
Change the model for app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,8 @@ from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
3 |
import torch
|
4 |
|
5 |
# Load the pre-trained model and tokenizer
|
6 |
-
|
7 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
8 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
|
10 |
# Define a function for sentiment analysis
|
11 |
def predict_sentiment(text):
|
@@ -31,6 +30,7 @@ def predict_sentiment(text):
|
|
31 |
|
32 |
return result
|
33 |
|
|
|
34 |
iface = gr.Interface(
|
35 |
fn=predict_sentiment,
|
36 |
inputs=gr.inputs.Textbox(lines=10, label="Enter financial statement"),
|
|
|
3 |
import torch
|
4 |
|
5 |
# Load the pre-trained model and tokenizer
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|
7 |
+
model = AutoModelForSequenceClassification.from_pretrained("mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis")
|
|
|
8 |
|
9 |
# Define a function for sentiment analysis
|
10 |
def predict_sentiment(text):
|
|
|
30 |
|
31 |
return result
|
32 |
|
33 |
+
# Define inputs and outputs directly without using gr.inputs or gr.outputs
|
34 |
iface = gr.Interface(
|
35 |
fn=predict_sentiment,
|
36 |
inputs=gr.inputs.Textbox(lines=10, label="Enter financial statement"),
|