MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / open_browser

Function open_browser

ui/easydiffusion/app.py:320–357  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

318
319
320def open_browser():
321 from easydiffusion.backend_manager import backend
322
323 config = getConfig()
324 ui = config.get("ui", {})
325 net = config.get("net", {})
326 port = net.get("listen_port", 9000)
327
328 if backend.is_installed():
329 if ui.get("open_browser_on_start", True):
330 import webbrowser
331
332 log.info("Opening browser..")
333
334 webbrowser.open(f"http://localhost:{port}")
335
336 Console().print(
337 Panel(
338 "\n"
339 + "[white]Easy Diffusion is ready to serve requests.\n\n"
340 + "A new browser tab should have been opened by now.\n"
341 + f"If not, please open your web browser and navigate to [bold yellow underline]http://localhost:{port}/\n",
342 title="Easy Diffusion is ready",
343 style="bold yellow on blue",
344 )
345 )
346 else:
347 backend_name = config["backend"]
348 Console().print(
349 Panel(
350 "\n"
351 + f"[white]Backend: {backend_name} is still installing..\n\n"
352 + "A new browser tab will open automatically after it finishes.\n"
353 + f"If it does not, please open your web browser and navigate to [bold yellow underline]http://localhost:{port}/\n",
354 title=f"Backend engine is installing",
355 style="bold yellow on blue",
356 )
357 )
358
359
360def fail_and_die(fail_type: str, data: str):

Callers 1

start_eventFunction · 0.90

Calls 3

getConfigFunction · 0.85
getMethod · 0.80
openMethod · 0.80

Tested by

no test coverage detected