Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
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"
|
@@ -11,8 +10,15 @@ 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=
|
17 |
-
outputs="text"
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
sentiment_pipeline = pipeline(
|
5 |
"sentiment-analysis",
|
6 |
model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
|
|
|
10 |
result = sentiment_pipeline(text)[0]
|
11 |
return f"{result['label']} (Confidence: {result['score']:.2f})"
|
12 |
|
13 |
+
# Explicitly define the Gradio interface with API support
|
14 |
gr.Interface(
|
15 |
fn=analyze,
|
16 |
+
inputs="text",
|
17 |
+
outputs="text",
|
18 |
+
title="Crypto News Sentiment Analysis",
|
19 |
+
allow_flagging="never"
|
20 |
+
).launch(
|
21 |
+
server_name="0.0.0.0",
|
22 |
+
server_port=7860,
|
23 |
+
share=True # Generates a public URL
|
24 |
+
)
|