Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
-
# Install necessary packages
|
2 |
-
!pip install transformers pandas google-colab
|
3 |
-
|
4 |
import pandas as pd
|
5 |
from transformers import pipeline
|
6 |
-
from google.colab import files
|
7 |
|
8 |
# Function to enhance title using Hugging Face model
|
9 |
def generate_title_with_huggingface(description):
|
10 |
result = generator(description, max_length=100, num_return_sequences=1)
|
11 |
return result[0]['generated_text']
|
12 |
|
13 |
-
#
|
|
|
14 |
uploaded = files.upload()
|
15 |
|
16 |
# Assuming the file name is 'output.csv' after upload
|
@@ -37,5 +35,5 @@ df['Keywords'] = df['Description'].apply(generate_keywords)
|
|
37 |
seo_output_file_path = 'seo_huggingface_filename_title_keywords.csv'
|
38 |
df[['Filename', 'Title', 'Keywords']].to_csv(seo_output_file_path, index=False)
|
39 |
|
40 |
-
# Download the resulting CSV file
|
41 |
files.download(seo_output_file_path)
|
|
|
|
|
|
|
|
|
1 |
import pandas as pd
|
2 |
from transformers import pipeline
|
3 |
+
from google.colab import files # Only needed if running in Google Colab
|
4 |
|
5 |
# Function to enhance title using Hugging Face model
|
6 |
def generate_title_with_huggingface(description):
|
7 |
result = generator(description, max_length=100, num_return_sequences=1)
|
8 |
return result[0]['generated_text']
|
9 |
|
10 |
+
# If running in Google Colab, use files.upload() to upload the CSV
|
11 |
+
# For local environment, you can replace this with a file path directly
|
12 |
uploaded = files.upload()
|
13 |
|
14 |
# Assuming the file name is 'output.csv' after upload
|
|
|
35 |
seo_output_file_path = 'seo_huggingface_filename_title_keywords.csv'
|
36 |
df[['Filename', 'Title', 'Keywords']].to_csv(seo_output_file_path, index=False)
|
37 |
|
38 |
+
# Download the resulting CSV file (if running in Colab)
|
39 |
files.download(seo_output_file_path)
|