Update app.py
Browse files
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
|
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
|
106 |
-
|
107 |
-
|
108 |
-
|
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:
|