Spaces:
Runtime error
Runtime error
Gagan Bhatia
commited on
Commit
·
b4e5842
1
Parent(s):
fad658f
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import yaml
|
| 3 |
+
|
| 4 |
+
from src.models.predict_model 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()
|