Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| model = pipeline("sentiment-analysis") | |
| def analizuj(tekst): | |
| wynik = model(tekst)[0] | |
| etykieta = "POZYTYWNY" if wynik["label"] == "POSITIVE" else "NEGATYWNY" | |
| pewnosc = round(wynik["score"] * 100, 1) | |
| return f"{etykieta} ({pewnosc}% pewności)" | |
| gr.Interface( | |
| fn=analizuj, | |
| inputs=gr.Textbox(label="Wpisz tekst po angielsku", placeholder="I love this!"), | |
| outputs=gr.Textbox(label="Wynik"), | |
| title="Analiza sentymentu", | |
| description="Czy tekst jest pozytywny czy negatywny?" | |
| ).launch() |