Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from fuzzywuzzy import process
|
|
| 5 |
import string
|
| 6 |
from nltk.corpus import stopwords
|
| 7 |
import nltk
|
|
|
|
| 8 |
|
| 9 |
nltk.download('stopwords')
|
| 10 |
|
|
@@ -95,12 +96,16 @@ if st.button("Process"):
|
|
| 95 |
st.write(f"{keyword}: {count}")
|
| 96 |
|
| 97 |
# Save to Excel
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
import string
|
| 6 |
from nltk.corpus import stopwords
|
| 7 |
import nltk
|
| 8 |
+
import io
|
| 9 |
|
| 10 |
nltk.download('stopwords')
|
| 11 |
|
|
|
|
| 96 |
st.write(f"{keyword}: {count}")
|
| 97 |
|
| 98 |
# Save to Excel
|
| 99 |
+
st.subheader("Download Results")
|
| 100 |
+
df = pd.DataFrame(list(results.items()), columns=["Keyword", "Count"])
|
| 101 |
+
output = io.BytesIO()
|
| 102 |
+
with pd.ExcelWriter(output, engine='openpyxl') as writer:
|
| 103 |
+
df.to_excel(writer, index=False, sheet_name="Results")
|
| 104 |
+
output.seek(0)
|
| 105 |
+
|
| 106 |
+
st.download_button(
|
| 107 |
+
label="Download Results as Excel",
|
| 108 |
+
data=output,
|
| 109 |
+
file_name="results.xlsx",
|
| 110 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 111 |
+
)
|