Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,19 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
prolog = Prolog()
|
4 |
-
prolog.consult("knowledge_base.pl")
|
5 |
|
6 |
def yes_man(message, history):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
if message.endswith("?"):
|
12 |
return prolog.query_once("eligible_for_ssi(john_doe)")
|
13 |
else:
|
|
|
1 |
+
import tempfile
|
2 |
import gradio as gr
|
3 |
+
import janus_swi as janus
|
|
|
|
|
4 |
|
5 |
def yes_man(message, history):
|
6 |
+
janus.consult("knowledge_base.pl")
|
7 |
+
tmp = tempfile.NamedTemporaryFile(suffix='.pl')
|
8 |
+
|
9 |
+
# Open the file for writing.
|
10 |
+
with open(tmp.name, 'w') as f:
|
11 |
+
f.write("""% Define the person
|
12 |
+
us_citizen(john_doe)
|
13 |
+
lawfully_residing(john_doe, 'U.S.', date(1996, 1, 1))
|
14 |
+
condition(john_doe, 'Blind')""")
|
15 |
+
janus.consult(tmp.name)
|
16 |
+
tmp.close()
|
17 |
if message.endswith("?"):
|
18 |
return prolog.query_once("eligible_for_ssi(john_doe)")
|
19 |
else:
|