sab commited on
Commit
944ffcd
1 Parent(s): b9b231f

fix layout

Browse files
Files changed (2) hide show
  1. app.py +5 -33
  2. config.py +20 -1
app.py CHANGED
@@ -50,9 +50,6 @@ pipe = FluxControlNetInpaintingPipeline.from_pretrained(
50
  pipe.transformer.to(torch.bfloat16)
51
  pipe.controlnet.to(torch.bfloat16)
52
 
53
- # Markdown description
54
- MARKDOWN = """# SnapClean | Remove Unwanted Objects from Photos 🔥Model by alimama-creative"""
55
-
56
 
57
  @spaces.GPU()
58
  def process(input_image_editor):
@@ -67,7 +64,7 @@ def process(input_image_editor):
67
  # Process image and mask
68
  image = input_image_editor['background']
69
  mask = input_image_editor['layers'][0]
70
- size = (768, 768)
71
  image_or = image.copy()
72
  image = image.convert("RGB").resize(size)
73
  mask = mask.convert("RGB").resize(size)
@@ -115,36 +112,11 @@ demo = gr.Interface(
115
  fn=process,
116
  inputs=image,
117
  outputs=[output_slider, gr.File(label="output png file")],
118
- title="Magic Eraser",
119
- )
 
120
 
121
- """
122
- # Gradio interface
123
- with gr.Blocks() as demo:
124
- gr.Markdown(MARKDOWN)
125
- with gr.Row():
126
- with gr.Column():
127
- input_image_editor_component = gr.ImageEditor(
128
- label='Image',
129
- type='pil',
130
- sources=["upload", "webcam"],
131
- image_mode='RGB',
132
- layers=False,
133
- brush=gr.Brush(colors=["#FFFFFF"], color_mode="fixed")
134
- )
135
- submit_button_component = gr.Button(
136
- value='Submit', variant='primary', scale=0
137
- )
138
- with gr.Column():
139
- output_image_component = ImageSlider(
140
- type='pil', image_mode='RGB', label='Processed photo'
141
- )
142
 
143
- submit_button_component.click(
144
- fn=process,
145
- inputs=[input_image_editor_component],
146
- outputs=[output_image_component]
147
- )
148
- """
149
 
150
  demo.launch(debug=False, show_error=True, share=True)
 
50
  pipe.transformer.to(torch.bfloat16)
51
  pipe.controlnet.to(torch.bfloat16)
52
 
 
 
 
53
 
54
  @spaces.GPU()
55
  def process(input_image_editor):
 
64
  # Process image and mask
65
  image = input_image_editor['background']
66
  mask = input_image_editor['layers'][0]
67
+ size = (512, 512)
68
  image_or = image.copy()
69
  image = image.convert("RGB").resize(size)
70
  mask = mask.convert("RGB").resize(size)
 
112
  fn=process,
113
  inputs=image,
114
  outputs=[output_slider, gr.File(label="output png file")],
115
+ title="🫧 Snap Clean 🧽",
116
+ description=config.DESCRIPTION,
117
+ footer=config.BUY_ME_A_COFFE
118
 
119
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
 
 
 
 
 
 
121
 
122
  demo.launch(debug=False, show_error=True, share=True)
config.py CHANGED
@@ -6,4 +6,23 @@ DEFAULT_CONTROLNET_CONDITIONING_SCALE = 0.9
6
  DEFAULT_GUIDANCE_SCALE = 3.5
7
  DEFAULT_SEED = 124
8
  DEFAULT_NUM_INFERENCE_STEPS = 24
9
- DEFAULT_TRUE_GUIDANCE_SCALE = 3.5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  DEFAULT_GUIDANCE_SCALE = 3.5
7
  DEFAULT_SEED = 124
8
  DEFAULT_NUM_INFERENCE_STEPS = 24
9
+ DEFAULT_TRUE_GUIDANCE_SCALE = 3.5
10
+
11
+ DESCRIPTION = """
12
+ <div style="max-width: 600px; margin: auto; font-family: Arial, sans-serif; color: #333;">
13
+ r <h1 style="text-align: center; color: #fff;">🧽🫧Snap Clean!</h1>
14
+ <p style="text-align: center; font-size: 1.1em; line-height: 1.6;">
15
+ Remove Unwanted Objects from Photos.
16
+ </p>
17
+ <p style="text-align: center; font-size: 1.1em; line-height: 1.6;">
18
+ </p>
19
+ </div>
20
+ """
21
+
22
+ BUY_ME_A_COFFE = """
23
+ <a href="https://buymeacoffee.com/thesab" target="_blank">
24
+ <button style="background-color: #FFDD00; border: none; color: black; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; border-radius: 10px;">
25
+ ☕ Buy Me a Coffee
26
+ </button>
27
+ </a>
28
+ """