Yaron Koresh commited on
Commit
209a22d
·
verified ·
1 Parent(s): 828c4cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -65,26 +65,31 @@ def generate_random_string(length):
65
  characters = string.ascii_letters + string.digits
66
  return ''.join(random.choice(characters) for _ in range(length))
67
 
68
- @spaces.GPU(duration=120)
69
  def Piper(_do):
70
  return pipe(
71
  _do,
72
  height=480,
73
  width=480,
74
  negative_prompt="",
75
- num_inference_steps=200,
76
- guidance_scale=9
77
  )
78
 
79
  def infer(prompt1,prompt2,prompt3,prompt4):
80
  name = generate_random_string(12)+".png"
81
 
82
  if prompt4 == None:
83
- prompt4 = ""
84
  else:
85
- prompt4 = " or " + " or ".join([translate(v,"english").upper() for v in prompt4])
 
 
 
 
 
 
86
 
87
- _dont = f'Show TEXT or LOGO{prompt4}.'
88
 
89
  if prompt1 == None:
90
  prompt1 = "element"
@@ -101,7 +106,7 @@ def infer(prompt1,prompt2,prompt3,prompt4):
101
  else:
102
  prompt3 = " ".join([translate(v,"english").upper() for v in prompt3]) + " event"
103
 
104
- _do = f'Show {prompt3}; Include {prompt2}; Focus on {prompt1}.'
105
  print(_do)
106
  image = Piper(_do).images[0].save(name)
107
  return name
 
65
  characters = string.ascii_letters + string.digits
66
  return ''.join(random.choice(characters) for _ in range(length))
67
 
68
+ @spaces.GPU
69
  def Piper(_do):
70
  return pipe(
71
  _do,
72
  height=480,
73
  width=480,
74
  negative_prompt="",
75
+ num_inference_steps=100,
76
+ guidance_scale=10
77
  )
78
 
79
  def infer(prompt1,prompt2,prompt3,prompt4):
80
  name = generate_random_string(12)+".png"
81
 
82
  if prompt4 == None:
83
+ prompt5 = ""
84
  else:
85
+ prompt5 = " or " + " or ".join([translate(v,"english") for v in prompt4])
86
+ _dont = f'Show TEXT or LOGO{prompt5}.'
87
+
88
+ if prompt4 == None:
89
+ prompt6 = "text and logos"
90
+ else:
91
+ prompt6 = "text and logos and " + " and ".join([translate(v,"english") for v in prompt4])
92
 
 
93
 
94
  if prompt1 == None:
95
  prompt1 = "element"
 
106
  else:
107
  prompt3 = " ".join([translate(v,"english").upper() for v in prompt3]) + " event"
108
 
109
+ _do = f'Show {prompt3}; Include {prompt2}; Focus on {prompt1}; Remove {prompt6}.'
110
  print(_do)
111
  image = Piper(_do).images[0].save(name)
112
  return name