Spaces:
Runtime error
Runtime error
Download app.py from PaiRin/Text_Token_Classification: direct link, hf CLI and curl.
- Browser
- Download file 501 Bytes
-
https://huggingface.co/spaces/PaiRin/Text_Token_Classification/resolve/main/app.py
- Command line
-
hf download hf://spaces/PaiRin/Text_Token_Classification/app.py
-
curl -L -o app.py https://huggingface.co/spaces/PaiRin/Text_Token_Classification/resolve/main/app.py
501 Bytes
| import streamlit as st | |
| from transformers import pipeline | |
| classifier = pipeline("token-classification", model="distilbert-base-uncased") | |
| def main(): | |
| st.title("Text Token Classification") | |
| with st.form("text_field"): | |
| text = st.text_area('type some text:') | |
| # clicked==True only when the button is clicked | |
| clicked = st.form_submit_button("Submit") | |
| if clicked: | |
| results = classifier([text]) | |
| st.json(results) | |
| if __name__ == "__main__": | |
| main() |