Skip to content

Add transformers example #1471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/sharing-editor/public/samples/023_transformers/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import streamlit as st

from transformers_js_py import pipeline

st.title("Sentiment analysis")

text = st.text_input("Input some text", "I love transformers!")

if text:
with st.spinner():
if "pipe" not in st.session_state:
st.session_state["pipe"] = await pipeline('sentiment-analysis')
pipe = st.session_state["pipe"]
out = await pipe(text)
st.write(out)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transformers-js-py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Transformers",
"entrypoint": "app.py"
}
Loading