lunarflu HF Staff commited on
Commit
ae40b5c
·
1 Parent(s): 5689742
Files changed (1) hide show
  1. app.py +33 -10
app.py CHANGED
@@ -80,15 +80,24 @@ class MyClient(discord.Client):
80
  #-> (stage_1_results, stage_1_param_path, stage_1_result_path)
81
 
82
  # input prompt
83
- prompt = message.content[12:].strip()
 
 
 
84
  number_of_images = 4
85
-
86
- # random seed
87
- current_time = int(time.time())
88
- random.seed(current_time)
89
- seed = random.randint(0, 2**32 - 1)
90
 
91
- stage_1_results, stage_1_param_path, stage_1_result_path = df.predict(prompt, "blur", seed,number_of_images,7.0, 'smart100',50, api_name="/generate64")
 
 
 
 
 
 
 
 
92
 
93
  #stage_1_results, stage_1_param_path, stage_1_result_path = df.predict("gradio written on a wall", "blur", 1,1,7.0, 'smart100',50, api_name="/generate64")
94
 
@@ -137,10 +146,24 @@ class MyClient(discord.Client):
137
 
138
 
139
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
-
142
-
143
-
 
 
144
 
145
  '''
146
  # stage 2
 
80
  #-> (stage_1_results, stage_1_param_path, stage_1_result_path)
81
 
82
  # input prompt
83
+ prompt = message.content[12:].strip()
84
+
85
+ negative_prompt = ''
86
+ seed = 0
87
  number_of_images = 4
88
+ guidance_scale = 7
89
+ custom_timesteps_1 = 'smart50'
90
+ number_of_inference_steps = 50
 
 
91
 
92
+ stage_1_results, stage_1_param_path, stage_1_result_path = client.predict(
93
+ prompt,
94
+ negative_prompt,
95
+ seed,
96
+ number_of_images,
97
+ guidance_scale,
98
+ custom_timesteps_1,
99
+ number_of_inference_steps,
100
+ api_name='/generate64')
101
 
102
  #stage_1_results, stage_1_param_path, stage_1_result_path = df.predict("gradio written on a wall", "blur", 1,1,7.0, 'smart100',50, api_name="/generate64")
103
 
 
146
 
147
 
148
 
149
+ selected_index_for_stage_2 = 0
150
+ seed_2 = 0
151
+ guidance_scale_2 = 4
152
+ custom_timesteps_2 = 'smart50'
153
+ number_of_inference_steps_2 = 50
154
+ imgif = client.predict(stage_1_result_path,
155
+ selected_index_for_stage_2,
156
+ seed_2,
157
+ guidance_scale_2,
158
+ custom_timesteps_2,
159
+ number_of_inference_steps_2,
160
+ api_name='/upscale256')
161
 
162
+ imgif_path = "/tmp/generated_image.png"
163
+ imgif.save(imgif_path)
164
+
165
+ with open(imgif_path, 'rb') as f:
166
+ await message.reply(f'Here is the generated image', file=discord.File(f, 'generated_image.png'))
167
 
168
  '''
169
  # stage 2