File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 2
2
import traceback
3
3
from collections import namedtuple
4
4
import inspect
5
+ from typing import Optional
5
6
6
7
from fastapi import FastAPI
7
8
from gradio import Blocks
@@ -62,7 +63,7 @@ def clear_callbacks():
62
63
callbacks_image_saved .clear ()
63
64
callbacks_cfg_denoiser .clear ()
64
65
65
- def app_started_callback (demo : Blocks , app : FastAPI ):
66
+ def app_started_callback (demo : Optional [ Blocks ] , app : FastAPI ):
66
67
for c in callbacks_app_started :
67
68
try :
68
69
c .callback (demo , app )
Original file line number Diff line number Diff line change @@ -114,6 +114,8 @@ def api_only():
114
114
app .add_middleware (GZipMiddleware , minimum_size = 1000 )
115
115
api = create_api (app )
116
116
117
+ modules .script_callbacks .app_started_callback (None , app )
118
+
117
119
api .launch (server_name = "0.0.0.0" if cmd_opts .listen else "127.0.0.1" , port = cmd_opts .port if cmd_opts .port else 7861 )
118
120
119
121
You can’t perform that action at this time.
0 commit comments