Update app.py
Browse files
app.py
CHANGED
@@ -72,27 +72,33 @@ WhatsApp: +91 (909) 229-6765
|
|
72 |
User: {{user_message}}
|
73 |
Kumaran:"""
|
74 |
|
75 |
-
|
76 |
prompt = PromptTemplate(
|
77 |
input_variables=["chat_history", "user_message"], template=template
|
78 |
)
|
79 |
|
80 |
memory = ConversationBufferMemory(memory_key="chat_history")
|
|
|
81 |
llm_chain = LLMChain(
|
82 |
llm=ChatOpenAI(temperature='0.5', model_name="gpt-3.5-turbo"),
|
83 |
prompt=prompt,
|
84 |
verbose=True,
|
85 |
memory=memory,
|
86 |
)
|
|
|
87 |
def get_text_response(user_message,history):
|
88 |
response = llm_chain.predict(user_message = user_message)
|
89 |
return response
|
90 |
-
|
91 |
-
theme =gr.themes.Default(primary_hue=
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
if __name__ == "__main__":
|
98 |
-
demo.launch()
|
|
|
72 |
User: {{user_message}}
|
73 |
Kumaran:"""
|
74 |
|
|
|
75 |
prompt = PromptTemplate(
|
76 |
input_variables=["chat_history", "user_message"], template=template
|
77 |
)
|
78 |
|
79 |
memory = ConversationBufferMemory(memory_key="chat_history")
|
80 |
+
|
81 |
llm_chain = LLMChain(
|
82 |
llm=ChatOpenAI(temperature='0.5', model_name="gpt-3.5-turbo"),
|
83 |
prompt=prompt,
|
84 |
verbose=True,
|
85 |
memory=memory,
|
86 |
)
|
87 |
+
|
88 |
def get_text_response(user_message,history):
|
89 |
response = llm_chain.predict(user_message = user_message)
|
90 |
return response
|
91 |
+
|
92 |
+
theme = gr.themes.Default(primary_hue="blue").set(
|
93 |
+
|
94 |
+
button_primary_background_fill="*primary_400",
|
95 |
+
button_primary_background_fill_hover="*primary_300",
|
96 |
+
|
97 |
+
)
|
98 |
+
|
99 |
+
demo = gr.ChatInterface(get_text_response,clear_btn=False,retry_btn=False,stop_btn=False,undo_btn=False,theme=theme,
|
100 |
+
chatbot= gr.Chatbot(bubble_full_width=False,label='Kum bot',show_label=True,height=350,show_share_button=False,
|
101 |
+
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?"])
|
102 |
|
103 |
if __name__ == "__main__":
|
104 |
+
demo.launch() #To create a public link, set `share=True` in `launch()`. To enable errors and logs, set `debug=True` in `launch()`.
|