[falcon] client >>> falconclient
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ DISCORD_TOKEN = os.environ.get("GRADIOTEST_TOKEN", None)
|
|
52 |
|
53 |
df = Client("huggingface-projects/IF", GRADIOTEST_TOKEN)
|
54 |
jojogan = Client("akhaliq/JoJoGAN", GRADIOTEST_TOKEN)
|
55 |
-
|
56 |
|
57 |
intents = discord.Intents.default()
|
58 |
intents.message_content = True
|
@@ -574,7 +574,7 @@ async def falcon(ctx, *, prompt: str):
|
|
574 |
|
575 |
if chathistory is not None: # This handles all subsequent discussions/prompts to the chatbot/model
|
576 |
instructions = "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."
|
577 |
-
job =
|
578 |
while job.done() == False:
|
579 |
status = job.status()
|
580 |
else:
|
@@ -588,11 +588,11 @@ async def falcon(ctx, *, prompt: str):
|
|
588 |
await ctx.reply(f"{output_text}")
|
589 |
|
590 |
if chathistory == None: # This handles the start of a conversation/chathistory file with the model
|
591 |
-
chathistory =
|
592 |
fn_index=5
|
593 |
)
|
594 |
instructions = "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."
|
595 |
-
job =
|
596 |
while job.done() == False:
|
597 |
status = job.status()
|
598 |
else:
|
|
|
52 |
|
53 |
df = Client("huggingface-projects/IF", GRADIOTEST_TOKEN)
|
54 |
jojogan = Client("akhaliq/JoJoGAN", GRADIOTEST_TOKEN)
|
55 |
+
falconclient = Client("HuggingFaceH4/falcon-chat", GRADIOTEST_TOKEN)
|
56 |
|
57 |
intents = discord.Intents.default()
|
58 |
intents.message_content = True
|
|
|
574 |
|
575 |
if chathistory is not None: # This handles all subsequent discussions/prompts to the chatbot/model
|
576 |
instructions = "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."
|
577 |
+
job = falconclient.submit(prompt, chathistory, instructions, 0.8, 0.9, fn_index=1) # This is not blocking
|
578 |
while job.done() == False:
|
579 |
status = job.status()
|
580 |
else:
|
|
|
588 |
await ctx.reply(f"{output_text}")
|
589 |
|
590 |
if chathistory == None: # This handles the start of a conversation/chathistory file with the model
|
591 |
+
chathistory = falconclient.predict(
|
592 |
fn_index=5
|
593 |
)
|
594 |
instructions = "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."
|
595 |
+
job = falconclient.submit(prompt, chathistory, instructions, 0.8, 0.9, fn_index=1) # This is not blocking
|
596 |
while job.done() == False:
|
597 |
status = job.status()
|
598 |
else:
|