merve HF staff commited on
Commit
296d90c
β€’
1 Parent(s): 1b8a80e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -15,13 +15,15 @@ def query(payload):
15
 
16
 
17
 
18
- st.title("Let's find out the best task for your use case! Tell me about your use case :)")
19
  context = "To extract information from documents, use sentence similarity task. To do sentiment analysis from tweets, use text classification task. To detect masks from images, use object detection task. To extract information from invoices, use named entity recognition from token classification task."
20
 
21
 
 
 
22
 
23
- for message_ in message_history:
24
- message(message_) # display all the previous message
25
 
26
  placeholder = st.empty() # placeholder for latest message
27
  input = st.text_input("You:")
@@ -41,11 +43,16 @@ data = query(
41
  }
42
  )
43
  try:
44
- bot_answer = data["answer"]
45
- message(f"{bot_answer} is the best task for this :)")
 
 
 
 
46
 
47
  except:
48
- message("Inference API is currently loading!")
 
49
 
50
 
51
 
 
15
 
16
 
17
 
18
+
19
  context = "To extract information from documents, use sentence similarity task. To do sentiment analysis from tweets, use text classification task. To detect masks from images, use object detection task. To extract information from invoices, use named entity recognition from token classification task."
20
 
21
 
22
+ message_history = ["Let's find out the best task for your use case! Tell me about your use case :)"]
23
+
24
 
25
+ for msg in message_history:
26
+ message(msg) # display all the previous message
27
 
28
  placeholder = st.empty() # placeholder for latest message
29
  input = st.text_input("You:")
 
43
  }
44
  )
45
  try:
46
+ model_answer = data["answer"]
47
+ response_templates = [f"{model_answer} is the best task for this 🀩", f"I think you should use {model_answer} πŸͺ„", f"I think {model_answer} should work for you πŸ€“"]
48
+ bot_answer = random.choice(response_templates)
49
+ message_history.append(bot_answer)
50
+
51
+
52
 
53
  except:
54
+ message("I'm listening πŸ‘€ ")
55
+ message_history.append("I'm listening πŸ‘€")
56
 
57
 
58