Theodore1211 commited on
Commit
cd9ff70
Β·
1 Parent(s): 4dd2a1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -15,25 +15,30 @@ messages = [
15
  def chatbot(input):
16
  if input:
17
  messages.append({"role": "user", "content": input})
18
- chat = openai.ChatCompletion.create(
19
- model="gpt-3.5-turbo", messages=messages
20
  )
21
- reply = chat.choices[0].message.content
22
  messages.append({"role": "assistant", "content": reply})
23
  return reply
24
 
25
  st.title("Adam")
26
  st.title("Your Healthy Keto expert")
27
 
 
 
28
 
 
29
 
30
- # Increase font size for better legibility on mobile devices
31
- st.markdown("<style>body { font-size: 18px; }</style>", unsafe_allow_html=True)
 
 
 
 
 
 
32
 
33
- # Use a mobile-friendly input method
34
- input_text = st.text_input("Ask me about food πŸ”, nutrition πŸ‰, and illness πŸ€•")
35
-
36
- if st.button("Send"):
37
  response = chatbot(input_text)
38
  st.write(response)
39
-
 
15
  def chatbot(input):
16
  if input:
17
  messages.append({"role": "user", "content": input})
18
+ chat = openai.Completion.create(
19
+ engine="davinci", prompt=messages, max_tokens=1024, n=1,stop=None,temperature=0.7
20
  )
21
+ reply = chat.choices[0].text
22
  messages.append({"role": "assistant", "content": reply})
23
  return reply
24
 
25
  st.title("Adam")
26
  st.title("Your Healthy Keto expert")
27
 
28
+ # Center the text and enlarge the font
29
+ st.markdown("<h1 style='text-align: center; font-size: 24px;'>Ask me about food πŸ”, nutrition πŸ‰, and illness πŸ€•</h1>", unsafe_allow_html=True)
30
 
31
+ input_text = st.text_input("Type here", key="input")
32
 
33
+ # Center and enlarge the send button
34
+ col1, col2, col3 = st.beta_columns([1, 8, 1])
35
+ with col2:
36
+ send = st.button("Send", key="send")
37
+ send.style.button_width = "100%"
38
+ send.style.font_size = "20px"
39
+ send.style.margin_top = "20px"
40
+ send.style.margin_bottom = "20px"
41
 
42
+ if send:
 
 
 
43
  response = chatbot(input_text)
44
  st.write(response)