Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,14 +7,14 @@ classifier = pipeline(
|
|
| 7 |
)
|
| 8 |
|
| 9 |
def predict(text):
|
| 10 |
-
|
| 11 |
-
return result[0]["label"]
|
| 12 |
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
gr.Markdown("# Sentiment Analysis")
|
| 15 |
-
|
| 16 |
-
|
| 17 |
btn = gr.Button("Analyze")
|
| 18 |
-
btn.click(
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
demo.launch()
|
|
|
|
| 7 |
)
|
| 8 |
|
| 9 |
def predict(text):
|
| 10 |
+
return classifier(text)[0]["label"]
|
|
|
|
| 11 |
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
gr.Markdown("# Sentiment Analysis")
|
| 14 |
+
inp = gr.Textbox(label="Enter text")
|
| 15 |
+
out = gr.Textbox(label="Sentiment")
|
| 16 |
btn = gr.Button("Analyze")
|
| 17 |
+
btn.click(predict, inp, out)
|
| 18 |
+
|
| 19 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 20 |
|
|
|