Update app.py
Browse files
app.py
CHANGED
@@ -29,17 +29,18 @@ def main():
|
|
29 |
# Read data
|
30 |
data = pd.read_csv(uploaded_file)
|
31 |
# Check if 'Description' and 'Published' columns exist
|
32 |
-
if 'Description' in data.columns
|
33 |
-
# Apply full translation and summarization
|
34 |
-
data['
|
35 |
-
|
36 |
-
)
|
37 |
-
# Apply first paragraph translation and summarization
|
38 |
-
data['First Paragraph Summary'] = data['Description'].apply(translate_and_summarize_first_paragraph)
|
39 |
# Display data in a table
|
40 |
-
st.write(data[['ID', 'Title', '
|
|
|
|
|
|
|
41 |
else:
|
42 |
-
st.error("Uploaded CSV does not contain required 'Description'
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
main()
|
|
|
29 |
# Read data
|
30 |
data = pd.read_csv(uploaded_file)
|
31 |
# Check if 'Description' and 'Published' columns exist
|
32 |
+
if 'Description' in data.columns:
|
33 |
+
# Apply full translation and summarization
|
34 |
+
data['DescriptionEn'] = data['Description'].apply(translate_and_summarize)
|
35 |
+
# Apply first paragraph translation and summarization for Title
|
36 |
+
data['Title'] = data['Description'].apply(translate_and_summarize_first_paragraph)
|
|
|
|
|
37 |
# Display data in a table
|
38 |
+
st.write(data[['ID', 'Title', 'DescriptionEn']])
|
39 |
+
# Provide download link for the updated CSV
|
40 |
+
csv = data.to_csv(index=False)
|
41 |
+
st.download_button(label="Download updated CSV", data=csv, file_name="updated_data.csv", mime="text/csv")
|
42 |
else:
|
43 |
+
st.error("Uploaded CSV does not contain required 'Description' column.")
|
44 |
|
45 |
if __name__ == "__main__":
|
46 |
main()
|