Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

app.py 1022 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  1. import streamlit as st
  2. import yaml
  3. from src.models.model import Summarization
  4. def predict_model(text: str):
  5. """
  6. Predict the summary of the given text.
  7. """
  8. with open("model_params.yml") as f:
  9. params = yaml.safe_load(f)
  10. model = Summarization()
  11. model.load_model(model_type=params["model_type"], model_dir="gagan3012/summarsiation")
  12. pre_summary = model.predict(text)
  13. return pre_summary
  14. def visualize():
  15. st.write("# Summarization UI")
  16. st.markdown(
  17. """
  18. *For additional questions and inquiries, please contact **Gagan Bhatia** via [LinkedIn](
  19. https://www.linkedin.com/in/gbhatia30/) or [Github](https://github.com/gagan3012).*
  20. """
  21. )
  22. text = st.text_area("Enter text here")
  23. if st.button("Generate Summary"):
  24. with st.spinner("Connecting the Dots..."):
  25. sumtext = predict_model(text=text)
  26. st.write("# Generated Summary:")
  27. st.write("{}".format(sumtext))
  28. if __name__ == "__main__":
  29. visualize()
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...