Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import janus_swi as janus
|
3 |
+
janus.consult("knowledge_base.pl")
|
4 |
+
|
5 |
+
def yes_man(message, history):
|
6 |
+
# % Define the person
|
7 |
+
janus.assertz("us_citizen(john_doe)")
|
8 |
+
janus.assertz("lawfully_residing(john_doe, 'U.S.', date(1996, 1, 1))")
|
9 |
+
janus.assertz("condition(john_doe, 'Blind')")
|
10 |
+
if message.endswith("?"):
|
11 |
+
return janus.query_once("eligible_for_ssi(john_doe)")
|
12 |
+
else:
|
13 |
+
return "Ask me about `eligible_for_ssi`!"
|
14 |
+
|
15 |
+
gr.ChatInterface(
|
16 |
+
yes_man,
|
17 |
+
title="Yes Man",
|
18 |
+
description="Ask Yes Man any question",
|
19 |
+
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
|
20 |
+
cache_examples=True,
|
21 |
+
retry_btn=None,
|
22 |
+
).launch()
|