|
import gradio as gr |
|
import fns |
|
|
|
import subprocess |
|
|
|
subprocess.run(["playwright", "install", "chromium"], check=True) |
|
|
|
|
|
def install_playwright_dependencies(): |
|
""" |
|
python -m playwright install-deps 명령을 subprocess로 실행 |
|
""" |
|
try: |
|
|
|
subprocess.run(["python", "-m", "playwright", "install-deps"], check=True) |
|
|
|
|
|
|
|
|
|
print("Playwright system dependencies installed successfully.") |
|
except subprocess.CalledProcessError as e: |
|
print("Failed to install Playwright dependencies.") |
|
print("Return code:", e.returncode) |
|
print("Command output:", e.output) |
|
except FileNotFoundError: |
|
print("Python 혹은 playwright를 찾지 못했습니다. pip로 playwright를 설치했는지 확인하세요.") |
|
except Exception as e: |
|
print("예상치 못한 오류가 발생했습니다:", e) |
|
|
|
|
|
install_playwright_dependencies() |
|
|
|
with gr.Blocks() as demo: |
|
generate = gr.Button() |
|
tb = gr.Textbox() |
|
|
|
generate.click(fn=fns.main, outputs=tb) |
|
|
|
|
|
demo.launch() |