scraperv2 / app.py
carsten12's picture
Create app.py
4a599d6 verified
Raw History Blame Contribute Delete
649 Bytes
import gradio as gr
import main
import time
def start_scraper():
logs = ""
try:
for log_line in main.run_scraper():
logs += log_line + "\n"
yield logs # yield progressively to update textbox
time.sleep(0.1) # small delay to help streaming UI update
except Exception as e:
yield logs + f"\n❌ Error during scraping: {e}"
with gr.Blocks() as demo:
gr.Markdown("# Google Maps Electricians Scraper")
start_btn = gr.Button("Start Scraper")
status_text = gr.Textbox(label="Status / Logs", lines=20)
start_btn.click(fn=start_scraper, outputs=status_text)
demo.launch()