Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio
|
2 |
+
import subprocess
|
3 |
+
|
4 |
+
examples = [["A qualified alien entered the United States on August 15, 1996. Tell me about their eligibility for Supplemental Security Income (SSI)."],
|
5 |
+
["""Question: Which of the following statements most accurately reflects the eligibility requirements for Supplemental Security Income (SSI) as outlined in the Alien Eligibility Under Welfare Reform?
|
6 |
+
A) To be eligible for SSI, an individual must be a U.S. citizen, with no exceptions for non-citizens.
|
7 |
+
B) SSI eligibility is extended to all individuals residing in the United States, regardless of their citizenship or immigration status.
|
8 |
+
C) To be eligible for SSI, an individual must be either a U.S. citizen or a qualified alien.
|
9 |
+
D) SSI eligibility is determined solely based on financial need, without consideration of citizenship or immigration status."""],
|
10 |
+
["""Explanate the Correct Answer: C
|
11 |
+
Question: Which of the following statements most accurately reflects the eligibility requirements for Supplemental Security Income (SSI) as outlined in the Alien Eligibility Under Welfare Reform?
|
12 |
+
A) To be eligible for SSI, an individual must be a U.S. citizen, with no exceptions for non-citizens.
|
13 |
+
B) SSI eligibility is extended to all individuals residing in the United States, regardless of their citizenship or immigration status.
|
14 |
+
C) To be eligible for SSI, an individual must be either a U.S. citizen or a qualified alien.
|
15 |
+
D) SSI eligibility is determined solely based on financial need, without consideration of citizenship or immigration status."""]]
|
16 |
+
|
17 |
+
def respond(message, *args, **kwargs):
|
18 |
+
command = [
|
19 |
+
"python", "-m", "graphrag.query",
|
20 |
+
"--root", "./ragtest",
|
21 |
+
"--method", "global",
|
22 |
+
message
|
23 |
+
]
|
24 |
+
|
25 |
+
try:
|
26 |
+
result = subprocess.run(command, capture_output=True, text=True, check=True)
|
27 |
+
return result.stdout
|
28 |
+
except subprocess.CalledProcessError as e:
|
29 |
+
return f"Error: {e.stderr}"
|
30 |
+
|
31 |
+
|
32 |
+
demo = gr.ChatInterface(
|
33 |
+
respond,
|
34 |
+
examples=examples)
|
35 |
+
|
36 |
+
|
37 |
+
if __name__ == "__main__":
|
38 |
+
demo.launch(auth=("tester", "8888p4ss"))
|