Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,13 @@
|
|
1 |
from hugchat import hugchat
|
2 |
-
from hugchat.login import Login
|
3 |
-
import streamlit as st
|
4 |
|
5 |
-
# Log in to huggingface and grant authorization to huggingchat
|
6 |
-
sign = Login("[email protected]", "@_3SegZXGjrjff/")
|
7 |
-
cookies = sign.login()
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
-
sign.saveCookiesToDir(cookie_path_dir)
|
12 |
|
13 |
-
#
|
14 |
-
chatbot = hugchat.ChatBot(cookies=cookies.get_dict()) # or cookie_path="usercookies/<email>.json"
|
15 |
-
print(chatbot.chat("Hi!"))
|
16 |
-
|
17 |
-
# Create a new conversation
|
18 |
id = chatbot.new_conversation()
|
19 |
chatbot.change_conversation(id)
|
20 |
|
21 |
-
|
22 |
-
conversation_list = chatbot.get_conversation_list()
|
23 |
-
if uinput := st.chat_input("How can I help you?"):
|
24 |
-
with st.chat_message:
|
25 |
-
st.markdown(chatbot.chat(uinput))
|
26 |
-
|
27 |
-
|
28 |
-
# # Switch model (default: meta-llama/Llama-2-70b-chat-hf. )
|
29 |
-
# chatbot.switch_llm(0) # Switch to `OpenAssistant/oasst-sft-6-llama-30b-xor`
|
30 |
-
# chatbot.switch_llm(1) # Switch to `meta-llama/Llama-2-70b-chat-hf`
|
31 |
-
|
32 |
|
|
|
|
1 |
from hugchat import hugchat
|
|
|
|
|
2 |
|
|
|
|
|
|
|
3 |
|
4 |
+
# Create a chatbot connection
|
5 |
+
chatbot = hugchat.ChatBot(cookie_path="cookies.json")
|
|
|
6 |
|
7 |
+
# New a conversation (ignore error)
|
|
|
|
|
|
|
|
|
8 |
id = chatbot.new_conversation()
|
9 |
chatbot.change_conversation(id)
|
10 |
|
11 |
+
uinput = input("Enter your message: ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
print(chatbot.chat(uinput))
|