johnslegers commited on
Commit
d2a0e37
1 Parent(s): fb3e7b3
Files changed (1) hide show
  1. modules/app.py +4 -4
modules/app.py CHANGED
@@ -86,7 +86,7 @@ async def ping():
86
 
87
  model_is_loading = True
88
 
89
- import runtime
90
 
91
  runtime.load_model_ckpt(ckpt_to_use=get_initial_model_to_load())
92
 
@@ -141,7 +141,7 @@ def save_model_to_config(model_name):
141
 
142
  @app.post('/image')
143
  def image(req : ImageRequest):
144
- import runtime
145
 
146
  r = Request()
147
  r.session_id = req.session_id
@@ -199,7 +199,7 @@ def stop():
199
  if model_is_loading:
200
  return {'ERROR'}
201
 
202
- import runtime
203
  runtime.stop_processing = True
204
 
205
  return {'OK'}
@@ -209,7 +209,7 @@ def stop():
209
 
210
  @app.get('/image/tmp/{session_id}/{img_id}')
211
  def get_image(session_id, img_id):
212
- import runtime
213
  buf = runtime.temp_images[session_id + '/' + img_id]
214
  buf.seek(0)
215
  return StreamingResponse(buf, media_type='image/jpeg')
 
86
 
87
  model_is_loading = True
88
 
89
+ from . import runtime
90
 
91
  runtime.load_model_ckpt(ckpt_to_use=get_initial_model_to_load())
92
 
 
141
 
142
  @app.post('/image')
143
  def image(req : ImageRequest):
144
+ from . import runtime
145
 
146
  r = Request()
147
  r.session_id = req.session_id
 
199
  if model_is_loading:
200
  return {'ERROR'}
201
 
202
+ from . import runtime
203
  runtime.stop_processing = True
204
 
205
  return {'OK'}
 
209
 
210
  @app.get('/image/tmp/{session_id}/{img_id}')
211
  def get_image(session_id, img_id):
212
+ from . import runtime
213
  buf = runtime.temp_images[session_id + '/' + img_id]
214
  buf.seek(0)
215
  return StreamingResponse(buf, media_type='image/jpeg')