Ahmad-Moiz
commited on
Commit
Β·
d50e4bc
1
Parent(s):
6be22aa
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,7 @@ def generate_summary(article, top_n=5):
|
|
66 |
|
67 |
# Set page configuration and styles
|
68 |
st.set_page_config(page_title="Article Summarizer", page_icon="βοΈ")
|
69 |
-
st.title("We
|
70 |
|
71 |
st.markdown(
|
72 |
"""
|
@@ -87,14 +87,6 @@ st.markdown(
|
|
87 |
}
|
88 |
.stText {
|
89 |
color: #333;
|
90 |
-
font-size: 16px; /* Adjust font size as needed */
|
91 |
-
}
|
92 |
-
.stCheckbox span {
|
93 |
-
font-size: 18px; /* Adjust font size as needed */
|
94 |
-
}
|
95 |
-
.stMarkdown h1 {
|
96 |
-
font-size: 24px; /* Adjust font size as needed */
|
97 |
-
font-weight: bold;
|
98 |
}
|
99 |
</style>
|
100 |
""",
|
@@ -102,18 +94,18 @@ st.markdown(
|
|
102 |
)
|
103 |
|
104 |
# Input text area
|
105 |
-
user_article = st.text_area("βοΈ
|
106 |
|
107 |
# Translation options
|
108 |
-
translate = st.checkbox("π
|
109 |
if translate:
|
110 |
-
target_language = st.selectbox("π
|
111 |
|
112 |
# Summarize button
|
113 |
if st.button("Summarize"):
|
114 |
if user_article:
|
115 |
summary = generate_summary(user_article)
|
116 |
-
st.subheader("π
|
117 |
st.write(summary)
|
118 |
|
119 |
# Translation logic
|
@@ -129,7 +121,7 @@ if st.button("Summarize"):
|
|
129 |
|
130 |
translator = Translator()
|
131 |
translated_summary = translator.translate(summary, dest=target_language_code)
|
132 |
-
st.subheader("π
|
133 |
st.write(translated_summary.text)
|
134 |
else:
|
135 |
-
st.warning("π«
|
|
|
66 |
|
67 |
# Set page configuration and styles
|
68 |
st.set_page_config(page_title="Article Summarizer", page_icon="βοΈ")
|
69 |
+
st.title("We sumerize and translate your articles")
|
70 |
|
71 |
st.markdown(
|
72 |
"""
|
|
|
87 |
}
|
88 |
.stText {
|
89 |
color: #333;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
</style>
|
92 |
""",
|
|
|
94 |
)
|
95 |
|
96 |
# Input text area
|
97 |
+
user_article = st.text_area("βοΈ Enter your article here:", height=100)
|
98 |
|
99 |
# Translation options
|
100 |
+
translate = st.checkbox("π Translate Summary")
|
101 |
if translate:
|
102 |
+
target_language = st.selectbox("π Select Target Language", ["πΊπΈ English", "π«π· French", "πͺπΈ Spanish", "π©πͺ German"])
|
103 |
|
104 |
# Summarize button
|
105 |
if st.button("Summarize"):
|
106 |
if user_article:
|
107 |
summary = generate_summary(user_article)
|
108 |
+
st.subheader("π Summary:")
|
109 |
st.write(summary)
|
110 |
|
111 |
# Translation logic
|
|
|
121 |
|
122 |
translator = Translator()
|
123 |
translated_summary = translator.translate(summary, dest=target_language_code)
|
124 |
+
st.subheader("π Translated Summary:")
|
125 |
st.write(translated_summary.text)
|
126 |
else:
|
127 |
+
st.warning("π« Please enter an article to summarize.")
|