Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,25 @@
|
|
1 |
-
import random
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
if
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|