from inference import infer import streamlit as st # # This is the app.py file required by streamlit (huggingface spaces) # See streamlit docs for more info https://docs.streamlit.io/ # Develop this app locally using: # streamlit run app.py # test in a browser: http://localhost:8501 # When ready to update the space, push this repo to huggingface: # ./push_to_space # def text_cb(): response = infer(st.session_state.inp_text) # st.write(response) for key, value in response.items(): if key != "neutral" or len(response.keys())==1: bottom.write(f"{key}: {value}") st.text_input("Type text in the box below", on_change=text_cb, key="inp_text") bottom = st.container() bottom.empty()