vmalapaka commited on
Commit
e195342
·
verified ·
1 Parent(s): 31be179

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -18
app.py CHANGED
@@ -23,30 +23,39 @@ if summarise_button:
23
  response_container = st.container()
24
  container = st.container()
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  with container:
28
  with st.form(key="my_form", clear_on_submit = True):
29
  user_input = st.text_area("Your question goes here:", key='input', height=100)
30
  submit_button = st.form_submit_button(label='Send')
 
 
 
 
31
 
32
 
33
- with response_container:
34
- st.write("Response Container")
35
-
36
- llm = ChatOpenAI(
37
- temperature=0,
38
- model_name='gpt-3.5-turbo-0125'
39
- )
40
-
41
- conversation = ConversationChain(
42
- llm=llm,
43
- verbose=True,
44
- memory=ConversationBufferMemory()
45
- )
46
 
47
- conversation("Hello AI Chat!")
48
- conversation("I am Samyukta")
49
- conversation.predict(input = "I stay in Hyderabad")
50
- print(conversation.memory.buffer)
51
 
52
- conversation.predict(input="What is my name?")
 
23
  response_container = st.container()
24
  container = st.container()
25
 
26
+ def get_response(User_input):
27
+
28
+ llm = ChatOpenAI(
29
+ temperature=0,
30
+ model_name='gpt-3.5-turbo-0125'
31
+ )
32
+
33
+ conversation = ConversationChain(
34
+ llm=llm,
35
+ verbose=True,
36
+ memory=ConversationBufferMemory()
37
+ )
38
+
39
+ conversation("Hello AI Chat!")
40
+ conversation("I am Samyukta")
41
+ conversation.predict(input = "I stay in Hyderabad")
42
+ print(conversation.memory.buffer)
43
+
44
+ response = conversation.predict(input="What is my name?")
45
+
46
+ return response
47
+
48
+
49
 
50
  with container:
51
  with st.form(key="my_form", clear_on_submit = True):
52
  user_input = st.text_area("Your question goes here:", key='input', height=100)
53
  submit_button = st.form_submit_button(label='Send')
54
+ if submit_button:
55
+ answer = get_response(user_input)
56
+ with response_container:
57
+ st.write(answer)
58
 
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
 
 
 
 
61