Spaces:
Sleeping
Sleeping
Commit
Β·
5bcd169
1
Parent(s):
15dff04
Update pages/Web-UI-ld.py
Browse files- pages/Web-UI-ld.py +5 -3
pages/Web-UI-ld.py
CHANGED
|
@@ -2,6 +2,10 @@ import streamlit as st
|
|
| 2 |
from streamlit_chat import message
|
| 3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Define the tokenizer and model
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained(st.session_state['model_name'])
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(st.session_state['model_name'])
|
|
@@ -10,8 +14,6 @@ if 'conversation' not in st.session_state:
|
|
| 10 |
st.session_state['conversation'] = None
|
| 11 |
if 'messages' not in st.session_state:
|
| 12 |
st.session_state['messages'] = []
|
| 13 |
-
if 'model_name' not in st.session_state:
|
| 14 |
-
st.session_state['model_name'] = "microsoft/DialoGPT-medium"
|
| 15 |
|
| 16 |
# Setting page title and header
|
| 17 |
st.set_page_config(page_title="Chat GPT Clone", page_icon=":robot_face:")
|
|
@@ -19,7 +21,7 @@ st.markdown("<h1 style='text-align: center;'>π» ChatterBot</h1>", unsafe_allow
|
|
| 19 |
st.subheader("How Can I Help You Today? π€")
|
| 20 |
|
| 21 |
st.sidebar.title("πποΈ")
|
| 22 |
-
st.session_state['model_name'] = st.sidebar.text_input("
|
| 23 |
summarise_button = st.sidebar.button("Summarise the conversation", key="summarise")
|
| 24 |
st.sidebar.image('./chatbot.jpg', width=300, use_column_width=True)
|
| 25 |
if summarise_button:
|
|
|
|
| 2 |
from streamlit_chat import message
|
| 3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 4 |
|
| 5 |
+
# Initialize the model_name key in the st.session_state dictionary
|
| 6 |
+
if 'model_name' not in st.session_state:
|
| 7 |
+
st.session_state['model_name'] = "microsoft/DialoGPT-medium"
|
| 8 |
+
|
| 9 |
# Define the tokenizer and model
|
| 10 |
tokenizer = AutoTokenizer.from_pretrained(st.session_state['model_name'])
|
| 11 |
model = AutoModelForCausalLM.from_pretrained(st.session_state['model_name'])
|
|
|
|
| 14 |
st.session_state['conversation'] = None
|
| 15 |
if 'messages' not in st.session_state:
|
| 16 |
st.session_state['messages'] = []
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Setting page title and header
|
| 19 |
st.set_page_config(page_title="Chat GPT Clone", page_icon=":robot_face:")
|
|
|
|
| 21 |
st.subheader("How Can I Help You Today? π€")
|
| 22 |
|
| 23 |
st.sidebar.title("πποΈ")
|
| 24 |
+
st.session_state['model_name'] = st.sidebar.text_input("Hugging Face Model Name", value="microsoft/DialoGPT-medium")
|
| 25 |
summarise_button = st.sidebar.button("Summarise the conversation", key="summarise")
|
| 26 |
st.sidebar.image('./chatbot.jpg', width=300, use_column_width=True)
|
| 27 |
if summarise_button:
|