Spaces:
Sleeping
Sleeping
Download app.py from jimlv/lightpanda-ui: direct link, hf CLI and curl.
- Browser
- Download file 624 Bytes
-
https://huggingface.co/spaces/jimlv/lightpanda-ui/resolve/main/app.py
- Command line
-
hf download hf://spaces/jimlv/lightpanda-ui/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jimlv/lightpanda-ui/resolve/main/app.py
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) |