Update app.py
Browse files
app.py
CHANGED
@@ -87,26 +87,30 @@ 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
|
|
|
95 |
download_placeholder = st.empty()
|
96 |
|
97 |
generate_button = st.sidebar.button("Generate All")
|
98 |
reset_button = st.sidebar.button("Reset")
|
99 |
|
100 |
-
# Generate
|
101 |
if generate_button and target_url:
|
102 |
df = get_backlinks(api_login, api_key, target_url, filters)
|
103 |
if df is not None:
|
|
|
|
|
|
|
104 |
# Convert DataFrame to CSV
|
105 |
csv = df.to_csv(index=False)
|
106 |
# Convert CSV to a string
|
107 |
b64 = base64.b64encode(csv.encode()).decode()
|
108 |
href = f'<a href="data:file/csv;base64,{b64}" download="backlinks.csv">Download CSV file</a>'
|
109 |
-
# Display the download link
|
110 |
download_placeholder.markdown(href, unsafe_allow_html=True)
|
111 |
|
112 |
# Reset functionality
|
|
|
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
|