File size: 649 Bytes
4a599d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()