Geek7 commited on
Commit
81bb2e1
·
verified ·
1 Parent(s): 000c673

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -13,6 +13,17 @@ CORS(app) # Enable CORS for all routes
13
  HF_TOKEN = os.environ.get("HF_TOKEN") # Ensure to set your Hugging Face token in the environment
14
  client = InferenceClient(token=HF_TOKEN)
15
 
 
 
 
 
 
 
 
 
 
 
 
16
  @app.route('/')
17
  def home():
18
  return "Welcome to the Image Background Remover!"
@@ -31,7 +42,7 @@ def generate_image(prompt, negative_prompt=None, height=512, width=512, model="s
31
  # Generate the image using Hugging Face's inference API with additional parameters
32
  image = client.text_to_image(
33
  prompt=prompt,
34
- negative_prompt=negative_prompt,
35
  height=height,
36
  width=width,
37
  model=model,
 
13
  HF_TOKEN = os.environ.get("HF_TOKEN") # Ensure to set your Hugging Face token in the environment
14
  client = InferenceClient(token=HF_TOKEN)
15
 
16
+ # Hardcoded negative prompt
17
+ HARDCODED_NEGATIVE_PROMPT = """((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)),
18
+ out of frame, extra fingers, mutated hands, ((poorly drawn hands)),
19
+ ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry,
20
+ ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face,
21
+ (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy),
22
+ gross proportions, (malformed limbs), ((missing arms)), ((missing legs)),
23
+ (((extra arms))), (((extra legs))), mutated hands, (fused fingers),
24
+ (too many fingers), (((long neck)))"""
25
+
26
+
27
  @app.route('/')
28
  def home():
29
  return "Welcome to the Image Background Remover!"
 
42
  # Generate the image using Hugging Face's inference API with additional parameters
43
  image = client.text_to_image(
44
  prompt=prompt,
45
+ negative_prompt=HARDCODED_NEGATIVE_PROMPT,
46
  height=height,
47
  width=width,
48
  model=model,