Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ def save_posts_to_csv(posts):
|
|
| 41 |
writer = csv.DictWriter(f, fieldnames=['title', 'content', 'featured_image_url', 'category', 'tags'])
|
| 42 |
writer.writeheader()
|
| 43 |
writer.writerows(posts)
|
| 44 |
-
return
|
| 45 |
|
| 46 |
def scrape_and_save(csv_file):
|
| 47 |
posts = scrape_urls(csv_file.name)
|
|
@@ -50,8 +50,8 @@ def scrape_and_save(csv_file):
|
|
| 50 |
|
| 51 |
demo = gr.Interface(
|
| 52 |
fn=scrape_and_save,
|
| 53 |
-
inputs=gr.
|
| 54 |
-
outputs=gr.
|
| 55 |
title="Web Scraping to CSV",
|
| 56 |
description="Upload a CSV file with URLs, and this app will scrape the content and provide a CSV with the results."
|
| 57 |
)
|
|
|
|
| 41 |
writer = csv.DictWriter(f, fieldnames=['title', 'content', 'featured_image_url', 'category', 'tags'])
|
| 42 |
writer.writeheader()
|
| 43 |
writer.writerows(posts)
|
| 44 |
+
return 'posts.csv'
|
| 45 |
|
| 46 |
def scrape_and_save(csv_file):
|
| 47 |
posts = scrape_urls(csv_file.name)
|
|
|
|
| 50 |
|
| 51 |
demo = gr.Interface(
|
| 52 |
fn=scrape_and_save,
|
| 53 |
+
inputs=gr.File(label="Upload CSV with URLs"),
|
| 54 |
+
outputs=gr.File(label="Download Posts CSV"),
|
| 55 |
title="Web Scraping to CSV",
|
| 56 |
description="Upload a CSV file with URLs, and this app will scrape the content and provide a CSV with the results."
|
| 57 |
)
|