nadzo commited on
Commit
4c37e0c
·
verified ·
1 Parent(s): 228b0be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,14 +1,16 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load sentiment analysis model
5
- sentiment_pipeline = pipeline("sentiment-analysis")
 
 
 
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..."),