my-test-space / app.py
elgamous's picture
Update app.py
4aeab18
import streamlit as st
import mediapipe as mp
#from transformers import pipeline
base_options = mp.tasks.BaseOptions(model_asset_path="classifier.tflite")
options = mp.tasks.text.TextClassifierOptions(base_options=base_options)
with mp.tasks.text.TextClassifier.create_from_options(options) as classifier:
text = st.text_area("enter some text")
result = classifier.classify(text)
category = result.classifications[0].categories[0]
if text and category:
st.json({
"name": category.category_name,
"score": category.score
})
#pipe = pipeline("sentiment-analysis")
#text = st.text_area("enter some text")
#if text:
# out = pipe(text)
# st.json(out)