zakerytclarke commited on
Commit
fa73971
·
verified ·
1 Parent(s): 289d0f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -5,7 +5,7 @@ import os
5
  import requests
6
  import time
7
  from langsmith import traceable
8
-
9
 
10
  ##### Begin Library Code
11
  from transformers import pipeline
@@ -294,7 +294,7 @@ def handle_chat(user_prompt, user_input, teapot_ai):
294
  st.sidebar.write("---")
295
 
296
  context = "\n".join(documents)
297
- prompt = "You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization."
298
  response = query_teapot(prompt, context+user_prompt, user_input, teapot_ai)
299
 
300
  with st.chat_message("assistant"):
@@ -325,14 +325,20 @@ def main():
325
  st.markdown(message["content"])
326
 
327
  user_input = st.chat_input("Ask me anything")
328
-
 
 
 
 
 
 
329
  s1, s2, s3 = st.columns([1, 2, 3])
330
  with s1:
331
- user_input = suggestion_button("Tell me about teapotllm") or user_input
332
  with s2:
333
- user_input = suggestion_button("Who invented quantum mechanics?") or user_input
334
  with s3:
335
- user_input = suggestion_button("Extract the year Google was founded") or user_input
336
 
337
  if user_input:
338
  with st.spinner('Generating Response...'):
 
5
  import requests
6
  import time
7
  from langsmith import traceable
8
+ import random
9
 
10
  ##### Begin Library Code
11
  from transformers import pipeline
 
294
  st.sidebar.write("---")
295
 
296
  context = "\n".join(documents)
297
+ prompt = """You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization.If a user asks who you are reply "I am Teapot"."""
298
  response = query_teapot(prompt, context+user_prompt, user_input, teapot_ai)
299
 
300
  with st.chat_message("assistant"):
 
325
  st.markdown(message["content"])
326
 
327
  user_input = st.chat_input("Ask me anything")
328
+ list1 = ["Tell me about teapotllm", "What is Teapot AI?", "How does teapotllm work?"]
329
+ list2 = ["Who invented quantum mechanics?", "Who are the authors of attention is all you need", "Tell me about popular places to travel in France"]
330
+ list3 = ["Extract the year Google was founded", "Extract the last name of the father of artificial intelligence", "Output the capital of New York","Extarct the city where the louvre is located"]
331
+
332
+ # Randomly select one from each list
333
+ random_selection = [random.choice(list1), random.choice(list2), random.choice(list3)]
334
+
335
  s1, s2, s3 = st.columns([1, 2, 3])
336
  with s1:
337
+ user_input = suggestion_button(random.choice(list1)) or user_input
338
  with s2:
339
+ user_input = suggestion_button(random.choice(list2)) or user_input
340
  with s3:
341
+ user_input = suggestion_button(random.choice(list3)) or user_input
342
 
343
  if user_input:
344
  with st.spinner('Generating Response...'):