RamAnanth1 commited on
Commit
8a600c4
1 Parent(s): e2e3d0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -3,20 +3,23 @@
3
  import gradio as gr
4
  import PIL.Image
5
  import os
6
- from gradio_client import Client
7
 
8
  lgm_mini_client = Client("dylanebert/LGM-mini")
9
  triposr_client = Client("stabilityai/TripoSR")
 
10
 
11
  def run(image, model_name):
12
  file_path = "temp.png"
13
  image.save(file_path)
 
14
  if model_name=='lgm-mini':
15
  result = lgm_mini_client.predict(
16
  file_path, # filepath in 'image' Image component
17
  api_name="/run"
18
  )
19
  output = result
 
20
  elif model_name=='triposr':
21
 
22
  process_result = triposr_client.predict(
@@ -31,6 +34,24 @@ def run(image, model_name):
31
  api_name="/generate")
32
 
33
  output = result[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  return output
35
 
36
 
 
3
  import gradio as gr
4
  import PIL.Image
5
  import os
6
+ from gradio_client import Client, file
7
 
8
  lgm_mini_client = Client("dylanebert/LGM-mini")
9
  triposr_client = Client("stabilityai/TripoSR")
10
+ crm_client = Client("Zhengyi/CRM")
11
 
12
  def run(image, model_name):
13
  file_path = "temp.png"
14
  image.save(file_path)
15
+
16
  if model_name=='lgm-mini':
17
  result = lgm_mini_client.predict(
18
  file_path, # filepath in 'image' Image component
19
  api_name="/run"
20
  )
21
  output = result
22
+
23
  elif model_name=='triposr':
24
 
25
  process_result = triposr_client.predict(
 
34
  api_name="/generate")
35
 
36
  output = result[0]
37
+
38
+ elif model=='crm':
39
+ preprocess_result = crm_client.predict(
40
+ file(file_path), # filepath in 'Image input' Image component
41
+ "Auto Remove background", # Literal['Alpha as mask', 'Auto Remove background'] in 'backgroud choice' Radio component
42
+ 1, # float (numeric value between 0.5 and 1.0) in 'Foreground Ratio' Slider component
43
+ "#000000", # str in 'Background Color' Colorpicker component
44
+ api_name="/preprocess_image"
45
+ )
46
+
47
+ result = crm_client.predict(
48
+ file(preprocess_result), # filepath in 'Processed Image' Image component
49
+ 1234, # float in 'seed' Number component
50
+ 5.5, # float in 'guidance_scale' Number component
51
+ 30, # float in 'sample steps' Number component
52
+ api_name="/gen_image"
53
+ )
54
+ output = result[2]
55
  return output
56
 
57