GoshawkVortexAI commited on
Commit
b7ba167
·
verified ·
1 Parent(s): 949ea0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -1,14 +1,22 @@
1
- import gradio as gr
2
  from transformers import pipeline
3
 
4
  # DistilBERT modelini yükle
5
- model = pipeline("sentiment-analysis", model="distilbert-base-uncased")
6
 
7
- def analyze_sentiment(text):
8
- return model(text)
9
 
10
- # Gradio arayüzünü oluştur
11
- iface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="json")
12
 
13
- # CPU üzerinde çalışacak şekilde başlat
14
- iface.launch(share=False)
 
 
 
 
 
 
 
 
 
1
+ import feedparser
2
  from transformers import pipeline
3
 
4
  # DistilBERT modelini yükle
5
+ model = pipeline("sentiment-analysis", model="distilbert-base-uncased", device=-1)
6
 
7
+ # Bitcoin haberleri için RSS feed URL'si
8
+ rss_url = "https://news.google.com/rss/search?q=Bitcoin&hl=en-US&gl=US&ceid=US:en"
9
 
10
+ # RSS feed'i al
11
+ feed = feedparser.parse(rss_url)
12
 
13
+ # Başlıkları al ve analiz et
14
+ for entry in feed.entries:
15
+ title = entry.title # Başlık
16
+ print(f"Başlık: {title}")
17
+
18
+ # DistilBERT ile duygu analizi yap
19
+ sentiment = model(title)
20
+
21
+ print(f"Duygu Analizi: {sentiment[0]['label']} - Güven Skoru: {sentiment[0]['score']:.4f}")
22
+ print("="*80)