lightpanda-ui / app.py
jimlv's picture
Update app.py
3d852be verified
Raw History Blame Contribute Delete
624 Bytes
import gradio as gr
import asyncio
from utils.browser_automation import fetch_page
async def scrape_page(url):
# 调用封装的函数与 Lightpanda 交互
content = await fetch_page(url)
return content
# 定义 Gradio 界面
iface = gr.Interface(
fn=scrape_page,
inputs=gr.Textbox(label="输入要抓取的 URL", placeholder="https://..."),
outputs=gr.HTML(label="页面内容"),
title="Lightpanda 浏览器管理面板",
description="在 Hugging Face 上免费部署的 Lightpanda 无头浏览器。"
)
if __name__ == "__main__":
iface.launch(server_name="0.0.0.0", server_port=7860)