matthoffner commited on
Commit
25a22d9
·
verified ·
1 Parent(s): 60f34ef

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -12
main.py CHANGED
@@ -1,6 +1,7 @@
1
  from llama_cpp.server.app import create_app, Settings
2
  from fastapi.responses import HTMLResponse
3
  from fastapi.middleware.cors import CORSMiddleware
 
4
  import os
5
 
6
  app = create_app(
@@ -18,18 +19,11 @@ app.add_middleware(
18
  allow_methods=["*"],
19
  allow_headers=["*"],
20
  )
21
-
22
- @app.get('/', response_class=HTMLResponse)
23
- def custom_index_route():
24
- html_content = """
25
- <html>
26
- <body>
27
- <h1>Test</h1>
28
- </body>
29
- </html>
30
- """
31
- return HTMLResponse(content=html_content)
32
 
33
  if __name__ == "__main__":
34
  import uvicorn
35
- uvicorn.run(app, host="https://matthoffner-llama-cpp-server.hf.space", port=7860)
 
1
  from llama_cpp.server.app import create_app, Settings
2
  from fastapi.responses import HTMLResponse
3
  from fastapi.middleware.cors import CORSMiddleware
4
+ from fastapi.responses import RedirectResponse
5
  import os
6
 
7
  app = create_app(
 
19
  allow_methods=["*"],
20
  allow_headers=["*"],
21
  )
22
+
23
+ @app.get("/")
24
+ async def redirect_root_to_docs():
25
+ return RedirectResponse("/docs")
 
 
 
 
 
 
 
26
 
27
  if __name__ == "__main__":
28
  import uvicorn
29
+ uvicorn.run(app, host="0.0.0.0", port=7860)