Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,17 @@ def main():
|
|
21 |
if uploaded_file is not None:
|
22 |
# Read data
|
23 |
data = pd.read_csv(uploaded_file)
|
24 |
-
# Check if 'Description'
|
25 |
-
if 'Description' in data.columns:
|
26 |
-
# Apply translation and summarization
|
27 |
-
data['Summary'] = data
|
|
|
|
|
28 |
# Display data in a table
|
29 |
st.write(data[['ID', 'Title', 'Summary']])
|
30 |
|
31 |
else:
|
32 |
-
st.error("Uploaded CSV does not contain 'Description'
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
-
main()
|
|
|
21 |
if uploaded_file is not None:
|
22 |
# Read data
|
23 |
data = pd.read_csv(uploaded_file)
|
24 |
+
# Check if 'Description' and 'Published' columns exist
|
25 |
+
if 'Description' in data.columns and 'Published' in data.columns:
|
26 |
+
# Apply translation and summarization based on 'Published' column
|
27 |
+
data['Summary'] = data.apply(
|
28 |
+
lambda row: translate_and_summarize(row['Description']) if pd.isna(row['Published']) else "", axis=1
|
29 |
+
)
|
30 |
# Display data in a table
|
31 |
st.write(data[['ID', 'Title', 'Summary']])
|
32 |
|
33 |
else:
|
34 |
+
st.error("Uploaded CSV does not contain required 'Description' and 'Published' columns.")
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
+
main()
|