joshuadunlop commited on
Commit
71194e2
·
verified ·
1 Parent(s): d9c7f55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -18
app.py CHANGED
@@ -87,31 +87,19 @@ col1, col2 = st.columns(2)
87
 
88
  with col1:
89
  st.header("Input")
90
- target_url = st.text_input("Enter the target URL")
91
-
92
- with col2:
93
- st.header("Output")
94
- # Placeholder for data table and download link
95
- data_placeholder = st.empty()
96
- download_placeholder = st.empty()
97
 
98
  generate_button = st.sidebar.button("Generate All")
99
  reset_button = st.sidebar.button("Reset")
100
 
101
- # Generate data table and download button
102
  if generate_button and target_url:
103
  df = get_backlinks(api_login, api_key, target_url, filters)
104
  if df is not None:
105
- # Display data table in the second column
106
- data_placeholder.dataframe(df)
107
-
108
- # Convert DataFrame to CSV
109
- csv = df.to_csv(index=False)
110
- # Convert CSV to a string
111
- b64 = base64.b64encode(csv.encode()).decode()
112
- href = f'<a href="data:file/csv;base64,{b64}" download="backlinks.csv">Download CSV file</a>'
113
- # Display the download link
114
- download_placeholder.markdown(href, unsafe_allow_html=True)
115
 
116
  # Reset functionality
117
  if reset_button:
 
87
 
88
  with col1:
89
  st.header("Input")
90
+ target_url = st.text_input("Enter the target URL") # Define target_url here
 
 
 
 
 
 
91
 
92
  generate_button = st.sidebar.button("Generate All")
93
  reset_button = st.sidebar.button("Reset")
94
 
95
+ # Generate CSV and download button
96
  if generate_button and target_url:
97
  df = get_backlinks(api_login, api_key, target_url, filters)
98
  if df is not None:
99
+ # Display the DataFrame in the second column
100
+ with col2:
101
+ st.header("Output")
102
+ st.dataframe(df)
 
 
 
 
 
 
103
 
104
  # Reset functionality
105
  if reset_button: