Spaces:
Paused
Paused
Download src/visualization/app.py from gagan3012/T5-Summarization: direct link, hf CLI and curl.
- Browser
- Download file 914 Bytes
-
https://huggingface.co/spaces/gagan3012/T5-Summarization/resolve/main/src/visualization/app.py
- Command line
-
hf download hf://spaces/gagan3012/T5-Summarization/src/visualization/app.py
-
curl -L -o app.py https://huggingface.co/spaces/gagan3012/T5-Summarization/resolve/main/src/visualization/app.py
914 Bytes
| import streamlit as st | |
| import yaml | |
| from src.models import predict_model | |
| def visualize(): | |
| st.write("# Summarization UI") | |
| st.markdown( | |
| """ | |
| *For additional questions and inquiries, please contact **Gagan Bhatia** via [LinkedIn]( | |
| https://www.linkedin.com/in/gbhatia30/) or [Github](https://github.com/gagan3012).* | |
| """ | |
| ) | |
| text = st.text_area("Enter text here") | |
| if st.button("Generate Summary"): | |
| with st.spinner("Connecting the Dots..."): | |
| sumtext = predict_model(text=text) | |
| st.write("# Generated Summary:") | |
| st.write("{}".format(sumtext)) | |
| with open("reports/visualization_metrics.txt", "w") as file1: | |
| file1.writelines(text) | |
| file1.writelines(sumtext) | |
| if __name__ == "__main__": | |
| with open("params.yml") as f: | |
| params = yaml.safe_load(f) | |
| if params["visualise"]: | |
| visualize() | |