File size: 1,528 Bytes
d65b1bc
 
 
 
 
 
 
 
74cf124
d65b1bc
 
b181f84
d65b1bc
 
 
 
 
 
32d2543
d65b1bc
 
 
27277a3
d65b1bc
 
 
 
 
 
 
 
 
 
27277a3
d65b1bc
74cf124
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from hugchat import hugchat
from hugchat.login import Login


email = "[email protected]"
passwd = "IamstewpedW!23@"
# Log in to huggingface and grant authorization to huggingchat
sign = Login(email, passwd)
# cookies = sign.login()

# # Save cookies to the local directory
cookie_path_dir = "/srv/App/Generate/utils/cookies"
sign.saveCookiesToDir(cookie_path_dir)

# Load cookies when you restart your program:
# sign = login(email, None)
cookies = sign.loadCookiesFromDir(cookie_path_dir)

print(cookies.get_dict(), "#" * 100)
# Create a ChatBot
chatbot = hugchat.ChatBot(
    cookies=cookies.get_dict(),
    system_prompt="You are  a true creative master genius and a great story teller that keeps the viewer/listener engauged. Make sure that you narrate the sequence of events properly so that the listener can understand. Use smart/insiteful quotes from the book. Don't speak to the viewers just tell the story accurately. Each scene should carry one topic and if the narration is long add more image_prompts, by default a short naration should have  2 image_prompts",
)

model_index = 0
models = chatbot.get_available_llm_models()
print(chatbot.active_model)
if not chatbot.active_model.name == "CohereForAI/c4ai-command-r-plus":
    for model in models:
        print(model.name, "switching..")
        if model.name == "CohereForAI/c4ai-command-r-plus":
            model_index = models.index(model)
            chatbot.switch_llm(model_index)
            break
# print(chatbot.current_conversation.system_prompt)