Update app.py
Browse files
app.py
CHANGED
|
@@ -114,29 +114,28 @@ async def preview_csv(file_path: str, scraper_func):
|
|
| 114 |
results = await process_csv(file_path, scraper_func)
|
| 115 |
return gr.DataFrame.from_dict(results)
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
| 138 |
|
| 139 |
if __name__ == "__main__":
|
| 140 |
-
|
| 141 |
-
layout=gr.TabbedInterface([linkedin_inputs, facebook_inputs]),
|
| 142 |
-
tabs=["LinkedIn", "Facebook"]).launch()
|
|
|
|
| 114 |
results = await process_csv(file_path, scraper_func)
|
| 115 |
return gr.DataFrame.from_dict(results)
|
| 116 |
|
| 117 |
+
with gr.Blocks() as demo:
|
| 118 |
+
linkedin_inputs = gr.Textbox(label="LinkedIn Profile URLs (one per line)")
|
| 119 |
+
with gr.Tab("LinkedIn"):
|
| 120 |
+
linkedin_csv_file = gr.File(label="Upload CSV", type="filepath")
|
| 121 |
+
linkedin_submit_btn = gr.Button("Scrape LinkedIn Profiles")
|
| 122 |
+
linkedin_preview_btn = gr.Button("Preview Results")
|
| 123 |
+
linkedin_preview_output = gr.Dataframe(label="Preview")
|
| 124 |
+
linkedin_scrape_output = gr.Dataframe(label="Scraped Data", visible=False)
|
| 125 |
+
|
| 126 |
+
facebook_inputs = gr.Textbox(label="Facebook Profile URLs (one per line)")
|
| 127 |
+
with gr.Tab("Facebook"):
|
| 128 |
+
facebook_csv_file = gr.File(label="Upload CSV", type="filepath")
|
| 129 |
+
facebook_submit_btn = gr.Button("Scrape Facebook Profiles")
|
| 130 |
+
facebook_preview_btn = gr.Button("Preview Results")
|
| 131 |
+
facebook_preview_output = gr.Dataframe(label="Preview")
|
| 132 |
+
facebook_scrape_output = gr.Dataframe(label="Scraped Data", visible=False)
|
| 133 |
+
|
| 134 |
+
linkedin_submit_btn.click(process_csv, inputs=[linkedin_csv_file, scrape_linkedin_profile], outputs=linkedin_scrape_output)
|
| 135 |
+
linkedin_preview_btn.click(preview_csv, inputs=[linkedin_csv_file, scrape_linkedin_profile], outputs=linkedin_preview_output)
|
| 136 |
+
|
| 137 |
+
facebook_submit_btn.click(process_csv, inputs=[facebook_csv_file, scrape_facebook_profile], outputs=facebook_scrape_output)
|
| 138 |
+
facebook_preview_btn.click(preview_csv, inputs=[facebook_csv_file, scrape_facebook_profile], outputs=facebook_preview_output)
|
| 139 |
|
| 140 |
if __name__ == "__main__":
|
| 141 |
+
demo.launch()
|
|
|
|
|
|