Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
result = classifier(text)[0]
|
| 9 |
-
label = result['label']
|
| 10 |
-
score = result['score']
|
| 11 |
-
return f"Sentiment: {label} ({score:.2f})"
|
| 12 |
-
|
| 13 |
-
with gr.Blocks() as demo:
|
| 14 |
-
gr.Markdown("# 🧠 Sentiment Analyzer")
|
| 15 |
-
gr.Markdown("Enter text and get the sentiment prediction!")
|
| 16 |
-
|
| 17 |
-
text_input = gr.Textbox(label="Enter your text")
|
| 18 |
-
analyze_button = gr.Button("Analyze Sentiment")
|
| 19 |
-
output = gr.Textbox(label="Result")
|
| 20 |
-
|
| 21 |
-
analyze_button.click(fn=analyze_sentiment, inputs=text_input, outputs=output)
|
| 22 |
|
| 23 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
+
def square_number(x):
|
| 4 |
+
return x ** 2
|
| 5 |
|
| 6 |
+
demo = gr.Interface(fn=square_number, inputs="number", outputs="number", title="🔢 Square Calculator")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
demo.launch()
|