Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
#
|
5 |
-
sentiment_pipeline = pipeline(
|
|
|
|
|
|
|
6 |
|
7 |
def analyze(text):
|
8 |
result = sentiment_pipeline(text)[0]
|
9 |
return f"{result['label']} (Confidence: {result['score']:.2f})"
|
10 |
|
11 |
-
# Create Gradio interface
|
12 |
gr.Interface(
|
13 |
fn=analyze,
|
14 |
inputs=gr.Textbox(placeholder="Enter crypto news headline..."),
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Use a financial/crypto-specific model
|
5 |
+
sentiment_pipeline = pipeline(
|
6 |
+
"sentiment-analysis",
|
7 |
+
model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
|
8 |
+
)
|
9 |
|
10 |
def analyze(text):
|
11 |
result = sentiment_pipeline(text)[0]
|
12 |
return f"{result['label']} (Confidence: {result['score']:.2f})"
|
13 |
|
|
|
14 |
gr.Interface(
|
15 |
fn=analyze,
|
16 |
inputs=gr.Textbox(placeholder="Enter crypto news headline..."),
|