import streamlit as st import streamlit.components.v1 as components from src.utils import summarize_en st.write("## ๐Ÿ‘ฅ Getting User Feedback with Tally forms") st.write("It's one thing to build performant models, it's another thing to prototype and test their performance in front of real users. By mixing Streamlit & Tally, this has never been easier.") st.write("The Streamlit app below uses google/pegasus-xsum to summarize an article. Run a summary, and share your feedback. ๐Ÿ’ฌ") placeholder_text = """Contemporary climate change includes both global warming and its impacts on Earth's weather patterns. There have been previous periods of climate change, but the current changes are distinctly more rapid and not due to natural causes. Instead, they are caused by the emission of greenhouse gases, mostly carbon dioxide (CO2) and methane. Burning fossil fuels for energy use creates most of these emissions. Certain agricultural practices, industrial processes, and forest loss are additional sources. Greenhouse gases are transparent to sunlight, allowing it through to heat the Earth's surface. When the Earth emits that heat as infrared radiation the gases absorb it, trapping the heat near the Earth's surface. As the planet heats up it causes changes like the loss of sunlight-reflecting snow cover, amplifying global warming. From: https://en.wikipedia.org/wiki/Climate_change""" feedback_url = """https://tally.so/embed/w2EX7A?alignLeft=1&hideTitle=1&transparentBackground=1""" with st.form("my_form"): st.write("#### Your long text goes here ๐Ÿ‡ฌ๐Ÿ‡งโ†˜๏ธ") txt_input = st.text_area("", placeholder_text,height=300) # Every form must have a submit button. submitted = st.form_submit_button("๐Ÿค– Summarize ") if submitted: with st.spinner(text="Summarizing text, this could take 10 seconds"): summary = summarize_en(txt_input) st.markdown("### Summary by Pegasus") st.markdown(">{}".format(summary)) # embed streamlit docs in a streamlit app components.iframe(feedback_url, height=800, scrolling=True) # st.write("Outside the form")