← back to Exo
serve tinychat static
a94bdbb9bde7515d1602eec0ed03aac7176089b0 · 2024-07-17 20:30:44 -0700 · Alex Cheema
Files touched
Diff
commit a94bdbb9bde7515d1602eec0ed03aac7176089b0
Author: Alex Cheema <alexcheema123@gmail.com>
Date: Wed Jul 17 20:30:44 2024 -0700
serve tinychat static
---
exo/api/chatgpt_api.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/exo/api/chatgpt_api.py b/exo/api/chatgpt_api.py
index 1480590b..8acfcaf5 100644
--- a/exo/api/chatgpt_api.py
+++ b/exo/api/chatgpt_api.py
@@ -2,6 +2,7 @@ import uuid
import time
import asyncio
import json
+from pathlib import Path
from transformers import AutoTokenizer
from typing import List, Literal, Union
from aiohttp import web
@@ -124,6 +125,12 @@ class ChatGPTAPI:
allow_methods="*",
)
})
+ self.static_dir = Path(__file__).parent.parent.parent / 'tinychat/examples/tinychat'
+ self.app.router.add_get('/', self.handle_root)
+ self.app.router.add_static('/', self.static_dir, name='static', show_index=False)
+
+ async def handle_root(self, request):
+ return web.FileResponse(self.static_dir / 'index.html')
async def handle_post(self, request):
data = await request.json()
← e82dab1d remove tinygrad hidden files
·
back to Exo
·
dont explicitly specify show_index 127b8e01 →