Spaces:
Runtime error
Runtime error
Gagan Bhatia
commited on
Commit
•
1064763
1
Parent(s):
1a723ba
Create app.py
Browse files- src/visualization/app.py +32 -0
src/visualization/app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import yaml
|
3 |
+
|
4 |
+
from src.models import predict_model
|
5 |
+
|
6 |
+
|
7 |
+
def visualize():
|
8 |
+
st.write("# Summarization UI")
|
9 |
+
st.markdown(
|
10 |
+
"""
|
11 |
+
*For additional questions and inquiries, please contact **Gagan Bhatia** via [LinkedIn](
|
12 |
+
https://www.linkedin.com/in/gbhatia30/) or [Github](https://github.com/gagan3012).*
|
13 |
+
"""
|
14 |
+
)
|
15 |
+
|
16 |
+
text = st.text_area("Enter text here")
|
17 |
+
if st.button("Generate Summary"):
|
18 |
+
with st.spinner("Connecting the Dots..."):
|
19 |
+
sumtext = predict_model(text=text)
|
20 |
+
st.write("# Generated Summary:")
|
21 |
+
st.write("{}".format(sumtext))
|
22 |
+
with open("reports/visualization_metrics.txt", "w") as file1:
|
23 |
+
file1.writelines(text)
|
24 |
+
file1.writelines(sumtext)
|
25 |
+
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
with open("params.yml") as f:
|
29 |
+
params = yaml.safe_load(f)
|
30 |
+
|
31 |
+
if params["visualise"]:
|
32 |
+
visualize()
|