Podtekatel commited on
Commit
8b21fe0
1 Parent(s): 74c6309

Added queue and usage count

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -16,6 +16,7 @@ logging.basicConfig(
16
  datefmt='%Y-%m-%d %H:%M:%S')
17
 
18
  MODEL_IMG_SIZE = 256
 
19
  def load_model():
20
  REPO_ID = "Podtekatel/JJBAGAN"
21
  FILENAME = "198_jjba_8_k_2_099_ep.onnx"
@@ -37,6 +38,11 @@ def inference(img):
37
  img = np.array(img)
38
  out_img = pipeline(img)
39
  out_img = Image.fromarray(out_img)
 
 
 
 
 
40
  return out_img
41
 
42
 
@@ -62,5 +68,5 @@ demo = gr.Interface(
62
  description=description,
63
  article=article,
64
  examples=examples)
65
-
66
  demo.launch()
 
16
  datefmt='%Y-%m-%d %H:%M:%S')
17
 
18
  MODEL_IMG_SIZE = 256
19
+ usage_count = 0
20
  def load_model():
21
  REPO_ID = "Podtekatel/JJBAGAN"
22
  FILENAME = "198_jjba_8_k_2_099_ep.onnx"
 
38
  img = np.array(img)
39
  out_img = pipeline(img)
40
  out_img = Image.fromarray(out_img)
41
+
42
+ global usage_count
43
+ usage_count += 1
44
+ logging.info(f'Usage count is {usage_count}')
45
+
46
  return out_img
47
 
48
 
 
68
  description=description,
69
  article=article,
70
  examples=examples)
71
+ demo.queue(concurrency_count=1)
72
  demo.launch()