joeljosehubert commited on
Commit
910caa5
·
verified ·
1 Parent(s): 6a3c35e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -1,10 +1,25 @@
1
- import random
2
  import gradio as gr
3
 
4
- def random_response(message, history):
5
- return random.choice(["Yes", "No"])
6
-
7
- demo = gr.ChatInterface(random_response)
8
-
9
- if __name__ == "__main__":
10
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def law_bot(message, history):
4
+ if message.endswith("Hi"):
5
+ return "Yes, my lordship? Do you have a question?"
6
+ else:
7
+ return "Look at you sir; no greetings for us lowly bots?"
8
+ if history("Hi"):
9
+ return "Greetings of the day, sir! How may i help you?"
10
+
11
+ demo = gr.ChatInterface(
12
+ law_bot,
13
+ chatbot=gr.Chatbot(height=100),
14
+ textbox=gr.Textbox(placeholder="Ask me a question of law", container=False, scale=4),
15
+ title="LawBot",
16
+ description="Ask me a legal question",
17
+ theme="gradio/monochrome",
18
+ examples=["What is Habeas Corpus?", "What is Mandamus?", "What is Certiorari?"],
19
+ cache_examples=True,
20
+ retry_btn=None,
21
+ undo_btn="Delete Previous",
22
+ clear_btn="Clear",
23
+ show_progress="full",
24
+ )
25
+ demo.launch()