Skip to content

Commit

Permalink
ready next gradio version
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Jun 29, 2024
1 parent 194e665 commit 18d3245
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def enable_log(PATH_LOGGING):

def main():
import gradio as gr
if gr.__version__ not in ['3.32.9', '3.32.10']:
if gr.__version__ not in ['3.32.9', '3.32.10', '3.32.11']:
raise ModuleNotFoundError("使用项目内置Gradio获取最优体验! 请运行 `pip install -r requirements.txt` 指令安装内置Gradio及其他依赖, 详情信息见requirements.txt.")
from request_llms.bridge_all import predict
from toolbox import format_io, find_free_port, on_file_uploaded, on_report_generated, get_conf, ArgsGeneralWrapper, DummyWith
Expand Down
10 changes: 10 additions & 0 deletions shared_utils/fastapi_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ async def file(path_or_url: str, request: fastapi.Request):
return "越权访问!"
return await endpoint(path_or_url, request)

from fastapi import Request, status
from fastapi.responses import FileResponse, RedirectResponse
@gradio_app.get("/academic_logout")
async def logout():
response = RedirectResponse(url=CUSTOM_PATH, status_code=status.HTTP_302_FOUND)
response.delete_cookie('access-token')
response.delete_cookie('access-token-unsecure')
return response

# --- --- enable TTS (text-to-speech) functionality --- ---
TTS_TYPE = get_conf("TTS_TYPE")
if TTS_TYPE != "DISABLE":
Expand Down Expand Up @@ -236,6 +245,7 @@ async def middleware(request: Request, call_next):
response = await call_next(request)
return response


# --- --- uvicorn.Config --- ---
ssl_keyfile = None if SSL_KEYFILE == "" else SSL_KEYFILE
ssl_certfile = None if SSL_CERTFILE == "" else SSL_CERTFILE
Expand Down

0 comments on commit 18d3245

Please sign in to comment.