Jonny001 commited on
Commit
c7b40e1
·
verified ·
1 Parent(s): 3a1878a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -1,6 +1,4 @@
1
  import gradio as gr
2
- import random
3
- import os
4
 
5
 
6
  models = {
@@ -17,16 +15,25 @@ default_negative_prompt = (
17
  "Cartoonish appearance, Plastic look, Grainy, Unnatural expressions, Crossed eyes, Mutated clothing, "
18
  "Artifacts, Uncanny valley, Doll-like features, Bad symmetry, Uneven skin tones, Extra teeth, "
19
  "Unrealistic hair texture, Dark shadows on face, Overexposed face, Cluttered background, Text, watermark, "
20
- "or signature, Over-processed"
 
 
21
  )
22
 
 
23
  def generate_image(text, negative_prompt):
24
  result_images = {}
25
  for model_name, model in models.items():
26
- result_images[model_name] = model(text, negative_prompt=negative_prompt)
 
 
 
 
 
27
 
28
  return [result_images[model_name] for model_name in models]
29
 
 
30
  interface = gr.Interface(
31
  fn=generate_image,
32
  inputs=[
@@ -38,4 +45,5 @@ interface = gr.Interface(
38
  description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
39
  )
40
 
41
- interface.launch()
 
 
1
  import gradio as gr
 
 
2
 
3
 
4
  models = {
 
15
  "Cartoonish appearance, Plastic look, Grainy, Unnatural expressions, Crossed eyes, Mutated clothing, "
16
  "Artifacts, Uncanny valley, Doll-like features, Bad symmetry, Uneven skin tones, Extra teeth, "
17
  "Unrealistic hair texture, Dark shadows on face, Overexposed face, Cluttered background, Text, watermark, "
18
+ "or signature, Over-processed, Low quality, Blurry, Low resolution, Pixelated, Oversaturated, Too dark, Overexposed, Poor lighting, "
19
+ "Unclear, Text or watermark, Distorted faces, Extra limbs or fingers, Disfigured, Grainy, Overly stylized, Cartoonish, "
20
+ "Unrealistic anatomy, Bad proportions, Unrealistic colors, Artificial look, Background noise, Unwanted objects, Repetitive patterns, Artifacting, Abstract shapes, Out of focus"
21
  )
22
 
23
+
24
  def generate_image(text, negative_prompt):
25
  result_images = {}
26
  for model_name, model in models.items():
27
+ try:
28
+
29
+ result_images[model_name] = model(text, negative_prompt=negative_prompt)
30
+ except TypeError:
31
+
32
+ result_images[model_name] = model(text)
33
 
34
  return [result_images[model_name] for model_name in models]
35
 
36
+
37
  interface = gr.Interface(
38
  fn=generate_image,
39
  inputs=[
 
45
  description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
46
  )
47
 
48
+
49
+ interface.launch()