Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from langchain_core.prompts import PromptTemplate
|
|
8 |
# from langchain.chains import LLMChain
|
9 |
from langchain_core.runnables import RunnableSequence
|
10 |
from langchain.memory import ConversationBufferMemory
|
|
|
11 |
|
12 |
OPENAI_API_KEY=os.getenv('OPENAI_API_KEY')
|
13 |
|
@@ -85,16 +86,16 @@ memory = ConversationBufferMemory(memory_key="chat_history")
|
|
85 |
|
86 |
llm = ChatOpenAI(temperature=0.5, model_name="gpt-3.5-turbo")
|
87 |
|
88 |
-
llm_chain =
|
89 |
|
90 |
def get_text_response(user_message,history):
|
91 |
-
|
92 |
-
response = llm_chain.
|
93 |
-
|
94 |
return response
|
95 |
|
96 |
theme =gr.themes.Default(primary_hue='purple')
|
97 |
-
demo = gr.ChatInterface(get_text_response,
|
98 |
chatbot= gr.Chatbot(bubble_full_width=False,label='Kum bot',show_label=True,height=350,show_share_button=False,
|
99 |
avatar_images=('https://res.cloudinary.com/dtbarluca/image/upload/v1692694826/user_1177568_mmmdi6.png','https://res.cloudinary.com/dtbarluca/image/upload/v1690875247/hlogo.ico_nqdhd6.png')),examples=["Where did you learn this techonologies?","What are your interests?","Which places do you like to visit?","Your greatest Achievements?","how can connect to you through linkedin?"])
|
100 |
if __name__ == "__main__":
|
|
|
8 |
# from langchain.chains import LLMChain
|
9 |
from langchain_core.runnables import RunnableSequence
|
10 |
from langchain.memory import ConversationBufferMemory
|
11 |
+
from langchain.chains import ConversationChain
|
12 |
|
13 |
OPENAI_API_KEY=os.getenv('OPENAI_API_KEY')
|
14 |
|
|
|
86 |
|
87 |
llm = ChatOpenAI(temperature=0.5, model_name="gpt-3.5-turbo")
|
88 |
|
89 |
+
llm_chain = ConversationChain(llm=llm,verbose=True,memory=memory)
|
90 |
|
91 |
def get_text_response(user_message,history):
|
92 |
+
|
93 |
+
response = llm_chain.predict(user_message = user_message)
|
94 |
+
|
95 |
return response
|
96 |
|
97 |
theme =gr.themes.Default(primary_hue='purple')
|
98 |
+
demo = gr.ChatInterface(get_text_response,theme=theme,
|
99 |
chatbot= gr.Chatbot(bubble_full_width=False,label='Kum bot',show_label=True,height=350,show_share_button=False,
|
100 |
avatar_images=('https://res.cloudinary.com/dtbarluca/image/upload/v1692694826/user_1177568_mmmdi6.png','https://res.cloudinary.com/dtbarluca/image/upload/v1690875247/hlogo.ico_nqdhd6.png')),examples=["Where did you learn this techonologies?","What are your interests?","Which places do you like to visit?","Your greatest Achievements?","how can connect to you through linkedin?"])
|
101 |
if __name__ == "__main__":
|