lunarflu HF Staff commited on
Commit
0e8c7ef
·
1 Parent(s): 6fb60de

[deepfloydif.py] creation

Browse files
Files changed (1) hide show
  1. deepfloydif.py +4 -25
deepfloydif.py CHANGED
@@ -15,6 +15,9 @@ MY_GUILD = discord.Object(id=MY_GUILD_ID)
15
  HF_TOKEN = os.getenv('HF_TOKEN')
16
  DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", Nonedeepfloyd_client = Client("huggingface-projects/IF", HF_TOKEN)
17
 
 
 
 
18
  #-------------------------------------------------------------------------------------------------------------------------------------
19
  # deepfloydif stage 1 generation
20
  def inference(prompt):
@@ -31,11 +34,7 @@ def inference(prompt):
31
 
32
  return [stage_1_results, stage_1_param_path, stage_1_result_path]
33
  #-------------------------------------------------------------------------------------------------------------------------------------
34
- # deepfloydIF command (generate images with realistic text using slash commands)
35
- @client.tree.command()
36
- @app_commands.describe(
37
- prompt='Enter a prompt to generate an image! Can generate realistic text, too!')
38
- async def deepfloydif(interaction: discord.Interaction, prompt: str):
39
  thread = None
40
  try:
41
  global BOT_USER_ID
@@ -75,23 +74,6 @@ async def deepfloydif(interaction: discord.Interaction, prompt: str):
75
  img3 = images[2]
76
  img4 = images[3]
77
 
78
-
79
- '''
80
- first_png = png_files[0]
81
- second_png = png_files[1]
82
- third_png = png_files[2]
83
- fourth_png = png_files[3]
84
-
85
- first_png_path = os.path.join(stage_1_results, first_png)
86
- second_png_path = os.path.join(stage_1_results, second_png)
87
- third_png_path = os.path.join(stage_1_results, third_png)
88
- fourth_png_path = os.path.join(stage_1_results, fourth_png)
89
-
90
- img1 = Image.open(first_png_path)
91
- img2 = Image.open(second_png_path)
92
- img3 = Image.open(third_png_path)
93
- img4 = Image.open(fourth_png_path)
94
- '''
95
  combined_image = Image.new('RGB', (img1.width * 2, img1.height * 2))
96
 
97
  combined_image.paste(img1, (0, 0))
@@ -114,9 +96,6 @@ async def deepfloydif(interaction: discord.Interaction, prompt: str):
114
 
115
  except Exception as e:
116
  print(f"Error: {e}")
117
- await message.remove_reaction('🔁', client.user)
118
- await message.add_reaction('❌')
119
- #await thread.send(f"Error: {e} <@811235357663297546> (continue_falcon error)")
120
  #-------------------------------------------------------------------------------------------------------------------------------------
121
  def load_image(png_files, stage_1_results, png_file_index):
122
  for file in png_files:
 
15
  HF_TOKEN = os.getenv('HF_TOKEN')
16
  DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", Nonedeepfloyd_client = Client("huggingface-projects/IF", HF_TOKEN)
17
 
18
+ BOT_USER_ID = 1086256910572986469
19
+ DEEPFLOYD_CHANNEL_ID = 1121834257959092234
20
+
21
  #-------------------------------------------------------------------------------------------------------------------------------------
22
  # deepfloydif stage 1 generation
23
  def inference(prompt):
 
34
 
35
  return [stage_1_results, stage_1_param_path, stage_1_result_path]
36
  #-------------------------------------------------------------------------------------------------------------------------------------
37
+ async def try_deepfloydif(interaction, prompt):
 
 
 
 
38
  thread = None
39
  try:
40
  global BOT_USER_ID
 
74
  img3 = images[2]
75
  img4 = images[3]
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  combined_image = Image.new('RGB', (img1.width * 2, img1.height * 2))
78
 
79
  combined_image.paste(img1, (0, 0))
 
96
 
97
  except Exception as e:
98
  print(f"Error: {e}")
 
 
 
99
  #-------------------------------------------------------------------------------------------------------------------------------------
100
  def load_image(png_files, stage_1_results, png_file_index):
101
  for file in png_files: