huijio commited on
Commit
2f38ad1
·
verified ·
1 Parent(s): d240efe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,17 +1,17 @@
1
- from fastapi import FastAPI, Request
2
  from fastapi.responses import RedirectResponse
3
  import subprocess
4
  import threading
5
 
6
  app = FastAPI()
7
 
8
- # Start Open WebUI in the background
9
- def run_openwebui():
10
- subprocess.run(["open-webui", "serve"])
 
 
11
 
12
- threading.Thread(target=run_openwebui, daemon=True).start()
13
-
14
- # Redirect to Open WebUI's port (default: 8080)
15
  @app.get("/")
16
- def redirect_to_webui():
17
  return RedirectResponse(url="http://localhost:8080")
 
1
+ from fastapi import FastAPI
2
  from fastapi.responses import RedirectResponse
3
  import subprocess
4
  import threading
5
 
6
  app = FastAPI()
7
 
8
+ # Start Open WebUI in background
9
+ threading.Thread(
10
+ target=lambda: subprocess.run(["open-webui", "serve"]),
11
+ daemon=True
12
+ ).start()
13
 
14
+ # Redirect to Open WebUI's port (8080)
 
 
15
  @app.get("/")
16
+ def home():
17
  return RedirectResponse(url="http://localhost:8080")