Spaces:
Sleeping
Sleeping
File size: 709 Bytes
956ca11 8a6d1ee 956ca11 8a6d1ee 956ca11 8a6d1ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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 = 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)
|