lunarflu HF Staff commited on
Commit
2cbce6d
·
1 Parent(s): 17f9d9d

added [falcon]

Browse files
Files changed (1) hide show
  1. app.py +29 -2
app.py CHANGED
@@ -46,7 +46,7 @@ DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
46
 
47
  df = Client("huggingface-projects/IF", GRADIOTEST_TOKEN)
48
  jojogan = Client("akhaliq/JoJoGAN", GRADIOTEST_TOKEN)
49
-
50
 
51
  intents = discord.Intents.default()
52
  intents.message_content = True
@@ -92,8 +92,9 @@ async def safetychecks(ctx):
92
  jojo_channel = 1114217739473649764
93
  sketch_channel = 1114218145343877180
94
  spidey_channel = 1114218191594471514
 
95
 
96
- channel_ids = [bot_test, deepfloydif_channel, jojo_channel, spidey_channel, sketch_channel]
97
  if ctx.channel.id not in channel_ids:
98
  print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
99
  thread = await ctx.message.create_thread(name=f'Channel Error')
@@ -550,6 +551,32 @@ async def on_reaction_add(reaction, user): # ctx = await bot.get_context(reac
550
 
551
 
552
  #----------------------------------------------------------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
554
  def run_bot():
555
  bot.run(DISCORD_TOKEN)
 
46
 
47
  df = Client("huggingface-projects/IF", GRADIOTEST_TOKEN)
48
  jojogan = Client("akhaliq/JoJoGAN", GRADIOTEST_TOKEN)
49
+ falcon = Client("https://huggingfaceh4-falcon-chat.hf.space/")
50
 
51
  intents = discord.Intents.default()
52
  intents.message_content = True
 
92
  jojo_channel = 1114217739473649764
93
  sketch_channel = 1114218145343877180
94
  spidey_channel = 1114218191594471514
95
+ falcon_channel = 1116089829147557999
96
 
97
+ channel_ids = [bot_test, deepfloydif_channel, jojo_channel, spidey_channel, sketch_channel, falcon_channel]
98
  if ctx.channel.id not in channel_ids:
99
  print(f"{ctx.author}, commands are not permitted in {ctx.channel}")
100
  thread = await ctx.message.create_thread(name=f'Channel Error')
 
551
 
552
 
553
  #----------------------------------------------------------------------------------------------------------------------------
554
+ @bot.command()
555
+ async def falcon(ctx, *, prompt: str):
556
+ try:
557
+ if await safetychecks(ctx):
558
+ if ctx.channel.id == 1116089829147557999:
559
+
560
+ filepath = "new.json"
561
+ result = client.predict(
562
+ prompt, # str in 'Type an input and press Enter' Textbox component
563
+ filepath, # str (filepath to JSON file) in 'parameter_9' Chatbot component
564
+ "The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. In the following interactions, User and Falcon will converse in natural language, and Falcon will answer User's questions. Falcon was built to be respectful, polite and inclusive. Falcon was built by the Technology Innovation Institute in Abu Dhabi. Falcon will never decline to answer a question, and always attempts to give an answer that User would be satisfied with. It knows a lot, and always tells the truth. The conversation begins.", # str in 'Instructions' Textbox component
565
+ 0.8, # int | float (numeric value between 0.1 and 2.0) in 'Temperature' Slider component
566
+ 0.9, # int | float (numeric value between 0.1 and 0.99) in 'p (nucleus sampling)' Slider component
567
+ fn_index=1
568
+ )
569
+
570
+ with open(result, "r") as file:
571
+ data = json.load(file)
572
+
573
+ await ctx.reply(f"Here's the resulting json file:\n{data}")
574
+
575
+ except Exception as e:
576
+ print(f"Error: {e}")
577
+ await ctx.reply(f"{e} cc <@811235357663297546> (falcon error)")
578
+ #----------------------------------------------------------------------------------------------------------------------------
579
+
580
 
581
  def run_bot():
582
  bot.run(DISCORD_TOKEN)