Fralet commited on
Commit
793fb2e
·
verified ·
1 Parent(s): 03838d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
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' column exists
25
- if 'Description' in data.columns:
26
- # Apply translation and summarization
27
- data['Summary'] = data['Description'].apply(translate_and_summarize)
 
 
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' column.")
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()