Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load the
|
5 |
sentiment_pipeline = pipeline(
|
6 |
-
"
|
7 |
-
model="
|
|
|
8 |
)
|
9 |
|
10 |
def analyze(text):
|
11 |
result = sentiment_pipeline(text)[0]
|
12 |
-
return {"label": result["label"], "score": result["score"]}
|
13 |
|
14 |
-
# Configure Gradio with explicit API support
|
15 |
gr.Interface(
|
16 |
fn=analyze,
|
17 |
inputs=gr.Textbox(placeholder="Enter crypto news headline..."),
|
18 |
-
outputs=gr.JSON(),
|
19 |
-
title="Crypto
|
20 |
flagging_mode="never"
|
21 |
).launch(
|
22 |
server_name="0.0.0.0",
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the crypto-specific sentiment model
|
5 |
sentiment_pipeline = pipeline(
|
6 |
+
"text-classification",
|
7 |
+
model="ElKulako/cryptobert", # Crypto-optimized model
|
8 |
+
tokenizer="ElKulako/cryptobert"
|
9 |
)
|
10 |
|
11 |
def analyze(text):
|
12 |
result = sentiment_pipeline(text)[0]
|
13 |
+
return {"label": result["label"], "score": result["score"]}
|
14 |
|
|
|
15 |
gr.Interface(
|
16 |
fn=analyze,
|
17 |
inputs=gr.Textbox(placeholder="Enter crypto news headline..."),
|
18 |
+
outputs=gr.JSON(),
|
19 |
+
title="Crypto-Specific Sentiment Analysis",
|
20 |
flagging_mode="never"
|
21 |
).launch(
|
22 |
server_name="0.0.0.0",
|