Commit
·
b3a7071
1
Parent(s):
593abff
fixing docs link for gradio interface
Browse files
app.py
CHANGED
|
@@ -820,10 +820,6 @@ def build_style_vector(
|
|
| 820 |
# ----------------------------
|
| 821 |
app = FastAPI()
|
| 822 |
|
| 823 |
-
# Add this after creating your FastAPI app
|
| 824 |
-
interface = create_documentation_interface()
|
| 825 |
-
app = gr.mount_gradio_app(app, interface, path="/documentation")
|
| 826 |
-
|
| 827 |
app.add_middleware(
|
| 828 |
CORSMiddleware,
|
| 829 |
allow_origins=["*"], # or lock to your domain(s)
|
|
@@ -2122,7 +2118,37 @@ def read_root():
|
|
| 2122 |
"""
|
| 2123 |
return Response(content=html_content, media_type="text/html")
|
| 2124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2125 |
@app.get("/documentation")
|
| 2126 |
def documentation():
|
| 2127 |
-
|
| 2128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 820 |
# ----------------------------
|
| 821 |
app = FastAPI()
|
| 822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
app.add_middleware(
|
| 824 |
CORSMiddleware,
|
| 825 |
allow_origins=["*"], # or lock to your domain(s)
|
|
|
|
| 2118 |
"""
|
| 2119 |
return Response(content=html_content, media_type="text/html")
|
| 2120 |
|
| 2121 |
+
def load_doc_content(filename: str) -> str:
|
| 2122 |
+
"""Load markdown content from docs directory, with fallback."""
|
| 2123 |
+
try:
|
| 2124 |
+
doc_path = Path(__file__).parent / "docs" / filename
|
| 2125 |
+
return doc_path.read_text(encoding='utf-8')
|
| 2126 |
+
except FileNotFoundError:
|
| 2127 |
+
return f"⚠️ Documentation file `{filename}` not found. Please check the docs directory."
|
| 2128 |
+
except Exception as e:
|
| 2129 |
+
return f"⚠️ Error loading `{filename}`: {e}"
|
| 2130 |
+
|
| 2131 |
@app.get("/documentation")
|
| 2132 |
def documentation():
|
| 2133 |
+
# Just return a simple combined markdown page
|
| 2134 |
+
all_content = f"""
|
| 2135 |
+
# MagentaRT Documentation
|
| 2136 |
+
|
| 2137 |
+
## About & Status
|
| 2138 |
+
{load_doc_content("about_status.md")}
|
| 2139 |
+
|
| 2140 |
+
## HTTP API
|
| 2141 |
+
{load_doc_content("api_http.md")}
|
| 2142 |
+
|
| 2143 |
+
## WebSocket API
|
| 2144 |
+
{load_doc_content("api_websocket.md")}
|
| 2145 |
+
|
| 2146 |
+
## Performance
|
| 2147 |
+
{load_doc_content("performance.md")}
|
| 2148 |
+
|
| 2149 |
+
## Changelog
|
| 2150 |
+
{load_doc_content("changelog.md")}
|
| 2151 |
+
"""
|
| 2152 |
+
|
| 2153 |
+
# Convert markdown to HTML if you want, or just serve as plain text
|
| 2154 |
+
return Response(content=all_content, media_type="text/plain")
|