Hanxiao Xiang commited on
Commit
4d77be5
1 Parent(s): 49f5d1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -1,10 +1,10 @@
1
- import subprocess
2
- subprocess.call("mim install 'mmengine>=0.6.0'", shell=True)
3
- subprocess.call("mim install 'mmcv>=2.0.0rc4,<2.1.0'", shell=True)
4
- subprocess.call("min install 'mmdet>=3.0.0,<4.0.0'", shell=True)
5
- subprocess.call("mim install 'mmyolo'", shell=True)
6
- subprocess.call("mim install 'mmpose'", shell=True)
7
- subprocess.call("mim install 'mmpretrain'", shell=True)
8
 
9
  import numpy as np
10
  import gradio as gr
@@ -61,7 +61,7 @@ def get_access_token(refatch=False) -> str:
61
  return access_token
62
 
63
 
64
- def resize_image(img, max_length=524, min_length=50) -> Tuple[np.ndarray, bool]:
65
  """Ensure that the longest side is shorter than 524px and the shortest side is longer than 50px.
66
  :param img: 前端传入的图片
67
  :param max_length: 最长边像素
@@ -196,7 +196,7 @@ def model2_rem(x):
196
  return new_img, resized_f
197
 
198
 
199
- def model3_ext(x: np.ndarray, num_clusters=12):
200
  """主色调提取
201
  :param x: 前端传入的图片
202
  :param num_clusters: 聚类的数量
@@ -329,7 +329,7 @@ with gr.Blocks() as demo:
329
  with gr.Row():
330
  with gr.Column():
331
  model3_input = gr.Image(height=400, image_mode='RGBA')
332
- model3_slider = gr.Slider(minimum=1, maximum=20, step=1, value=12,
333
  min_width=400, label="聚类数量")
334
  with gr.Column():
335
  model3_output_img = gr.Image(height=100)
 
1
+ # import subprocess
2
+ # subprocess.call("mim install 'mmengine>=0.6.0'", shell=True)
3
+ # subprocess.call("mim install 'mmcv>=2.0.0rc4,<2.1.0'", shell=True)
4
+ # subprocess.call("min install 'mmdet>=3.0.0,<4.0.0'", shell=True)
5
+ # subprocess.call("mim install 'mmyolo'", shell=True)
6
+ # subprocess.call("mim install 'mmpose'", shell=True)
7
+ # subprocess.call("mim install 'mmpretrain'", shell=True)
8
 
9
  import numpy as np
10
  import gradio as gr
 
61
  return access_token
62
 
63
 
64
+ def resize_image(img, max_length=2048, min_length=50) -> Tuple[np.ndarray, bool]:
65
  """Ensure that the longest side is shorter than 524px and the shortest side is longer than 50px.
66
  :param img: 前端传入的图片
67
  :param max_length: 最长边像素
 
196
  return new_img, resized_f
197
 
198
 
199
+ def model3_ext(x: np.ndarray, num_clusters=8):
200
  """主色调提取
201
  :param x: 前端传入的图片
202
  :param num_clusters: 聚类的数量
 
329
  with gr.Row():
330
  with gr.Column():
331
  model3_input = gr.Image(height=400, image_mode='RGBA')
332
+ model3_slider = gr.Slider(minimum=1, maximum=20, step=1, value=8,
333
  min_width=400, label="聚类数量")
334
  with gr.Column():
335
  model3_output_img = gr.Image(height=100)