Spaces:
Runtime error
Runtime error
Update app/main.py
Browse files- app/main.py +9 -1
app/main.py
CHANGED
|
@@ -11,7 +11,7 @@ import openai
|
|
| 11 |
from fastapi import FastAPI,Request
|
| 12 |
from fastapi.staticfiles import StaticFiles
|
| 13 |
from fastapi.templating import Jinja2Templates
|
| 14 |
-
from fastapi.responses import HTMLResponse,JSONResponse
|
| 15 |
|
| 16 |
#鍵関連
|
| 17 |
from fastapi import Depends, HTTPException
|
|
@@ -324,6 +324,14 @@ def parent_d4html(parent_d,n):#word検索ではnは無し,sound検索では_1,
|
|
| 324 |
return new_d
|
| 325 |
|
| 326 |
# =============# 自然言語クエリに最も近いnameを検索,対応するノードのidを取得=>自身,親,子を辞書で返す
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
@app.get("/word_search", response_class=HTMLResponse)
|
| 328 |
async def read_root(request:Request, api_key:str=""):
|
| 329 |
api_key = request.session.get("api_key", "please_input_your_api_key")
|
|
|
|
| 11 |
from fastapi import FastAPI,Request
|
| 12 |
from fastapi.staticfiles import StaticFiles
|
| 13 |
from fastapi.templating import Jinja2Templates
|
| 14 |
+
from fastapi.responses import HTMLResponse,JSONResponse,RedirectResponse
|
| 15 |
|
| 16 |
#鍵関連
|
| 17 |
from fastapi import Depends, HTTPException
|
|
|
|
| 324 |
return new_d
|
| 325 |
|
| 326 |
# =============# 自然言語クエリに最も近いnameを検索,対応するノードのidを取得=>自身,親,子を辞書で返す
|
| 327 |
+
@app.get("/")
|
| 328 |
+
def read_root():
|
| 329 |
+
# リダイレクト先のURLを指定してRedirectResponseを作成
|
| 330 |
+
redirect_url = "/word_search"
|
| 331 |
+
response = RedirectResponse(url=redirect_url)
|
| 332 |
+
return response
|
| 333 |
+
|
| 334 |
+
|
| 335 |
@app.get("/word_search", response_class=HTMLResponse)
|
| 336 |
async def read_root(request:Request, api_key:str=""):
|
| 337 |
api_key = request.session.get("api_key", "please_input_your_api_key")
|