Spaces:
Runtime error
Runtime error
File size: 580 Bytes
195029e 7a8768f 195029e 1a21231 195029e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import torch
import streamlit as st
from transformers import pipeline
title="Sentiment Analysis"
classifier = pipeline(task="sentiment-analysis",
model="distilbert-base-uncased-finetuned-sst-2-english")
def main():
st.title(title)
with st.form("questionaire"):
prompt1 = st.text_input("your text")
clicked = st.form_submit_button("start")
if clicked:
results=classifier(prompt1)
st.text(results[0]['label'])
st.text(f"Score : {results[0]['score']}")
if __name__=='__main__':
main()
|