Spaces:
Runtime error
Runtime error
| import os | |
| import streamlit as st | |
| from transformers import pipeline | |
| from huggingface_hub.inference_api import InferenceApi | |
| API_TOKEN = os.getenv('My_Token') | |
| inference = InferenceApi(repo_id="bert-base-uncased", token=API_TOKEN) | |
| # inference(inputs="The goal of life is [MASK].") | |
| text1 = st.text_area("enter some text 111") | |
| if text1: | |
| res = inference(inputs="The goal of life is [MASK].") | |
| st.json(res) | |
| pipe = pipeline("sentiment-analysis") | |
| text2 = st.text_area("enter some text 222") | |
| if text2: | |
| out = pipe(text) | |
| st.json(out) | |
| # import streamlit as st | |
| # # adding the text that will show in the text box as default | |
| # default_value = "See how a modern neural network auto-completes your text π€ This site, built by the Hugging Face team, lets you write a whole document directly from your browser, and you can trigger the Transformer anywhere using the Tab key. Its like having a smart machine that completes your thoughts π Get started by typing a custom snippet, check out the repository, or try one of the examples. Have fun!" | |
| # sent = st.text_area("Text", default_value, height = 275) | |
| # max_length = st.sidebar.slider("Max Length", min_value = 10, max_value=30) | |
| # temperature = st.sidebar.slider("Temperature", value = 1.0, min_value = 0.0, max_value=1.0, step=0.05) | |
| # top_k = st.sidebar.slider("Top-k", min_value = 0, max_value=5, value = 0) | |
| # top_p = st.sidebar.slider("Top-p", min_value = 0.0, max_value=1.0, step = 0.05, value = 0.9) | |
| # num_return_sequences = st.sidebar.number_input('Number of Return Sequences', min_value=1, max_value=5, value=1, step=1) | |