Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- __pycache__/gradio_app.cpython-311.pyc +0 -0
- gradio_app.py +9 -10
__pycache__/gradio_app.cpython-311.pyc
CHANGED
Binary files a/__pycache__/gradio_app.cpython-311.pyc and b/__pycache__/gradio_app.cpython-311.pyc differ
|
|
gradio_app.py
CHANGED
@@ -15,17 +15,16 @@ mistral_client = OpenAI(
|
|
15 |
)
|
16 |
|
17 |
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
prompt = """Task: Given examples of a Supreme Court case and the statutes applied in that case, your objective is to make accurate predictions of the specific charge or statute that is most likely to be applied within the context of the case delimited by triple backticks (```), ensuring exact predictions and learning from the provided examples.You should only include the statutes it is most confident about.The response format should include the statutes applied as in the context.
|
22 |
-
You should to showcase creativity and knowledge to enhance the accuracy of statute predictions based on the given fact statement.
|
23 |
|
24 |
Context:
|
25 |
-----
|
26 |
-
Fact Statement:"
|
27 |
|
28 |
-
Statutes:['
|
29 |
-----
|
30 |
|
31 |
###
|
@@ -44,13 +43,13 @@ Think step by step to cover all possible statutes that are relevant to the fact
|
|
44 |
Fact Statement: ```{fact}```
|
45 |
"""
|
46 |
|
47 |
-
def generate(input_text
|
48 |
com = prompt.format(fact=input_text)
|
49 |
print(input_text)
|
50 |
chat_completion = mistral_client.chat.completions.create(
|
51 |
# model="gpt-4-turbo",
|
52 |
model='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4',
|
53 |
-
temperature=
|
54 |
messages=[
|
55 |
{"role": "system", "content": "You are a helpful assistant who is expert in tagging FIRs with relevant statutes from IPC among other special acts."},
|
56 |
{
|
@@ -127,12 +126,12 @@ demo = gr.Interface(
|
|
127 |
# gr.Slider(minimum=0.1,maximum=1.0,value=0.5,step=0.1),
|
128 |
],
|
129 |
outputs=gr.Textbox(label="Predicted Statutes"),
|
130 |
-
examples=[[
|
131 |
)
|
132 |
|
133 |
demo.launch()
|
134 |
|
135 |
|
136 |
|
137 |
-
|
138 |
|
|
|
15 |
)
|
16 |
|
17 |
|
18 |
+
fact_example = '''In service Mr. In-charge Inspector Mr. City of Police Station Kotwali Mr. G Candidate Chetna Gupta alias Chanchal Gupta Advocate Resident of Flat No., 76/44 Halsey Road Kanpur Nagar and practicing law from a pucca chamber just in front of CMO office at Kachehri. On 2024, at around 8: 30 am, my chamber suddenly caught fire and at around 9: 00 am, I got a call informing me that my chamber was on fire. I reached the chamber immediately. By then, Manish, who was cleaning my chamber, was dousing the fire with water. All my chamber's luggage, files, AC, sofa wings, amalt glass walls, necessary documents, miscellaneous items, etc. have been destroyed. I am informing the concerned post. Please take appropriate action. Dated 29. 2024 Signature English unreadable Candidate Chetna Gupta alias Chanchal Gupta Md. 7376222267 Note I hereby certify that 674 Dhirendra Pratap Singh, permanent & tahrir copy of the complaint was literally typed by me on the computer 5057 Lalit Kumar. That I attest to.'''
|
19 |
|
20 |
+
prompt = """Task: Given examples of an FIR and the statutes applied in that case, your objective is to make accurate predictions of the specific charge or statute that is most likely to be applied within the context of the case delimited by triple backticks (```), ensuring exact predictions and learning from the provided examples.You should only include the statutes it is most confident about.The response format should include the statutes applied as in the context.
|
21 |
+
You should to showcase creativity and knowledge to enhance the accuracy of statute predictions based on the given fact statement.
|
|
|
|
|
22 |
|
23 |
Context:
|
24 |
-----
|
25 |
+
Fact Statement:"Nakal Tahrir Hindi Plaintiff Service in Mr. SHO Sir Police Station Akrawad District Aligarh Sir, today on 24/4/2021, I along with Deputy Inspector Kapil Dev Maya Hamrah Ka0 406 Narsingh was in the police station area in the police station area to effectively follow the preventive action and public to follow the public in connection with the election. Ravindra Giri, a candidate for the post of panchayat member, along with his supporters, has violated the rules of code of conduct and public care by violating Section 144 CrPC by violating Section 144 CrPC by violating the campaign vehicle UP 86 T 5771 MAX without any permission in his favor with his supporters. In which there was full possibility of spreading the infection, the documents of the said vehicle were asked from the candidate Ravindra Giri, then the vehicle number UP 86 T 5771 was seized under section 207 MV Act and Gavendra Giri son of Moti Giri and Jitendra Giri son of Ramprakash Giri and Gaurav Giri son of Jugendra Giri Ni0 Gana Kathera police station Vijaygarh district Aligarh and Yogesh Kumar son of Rajendra Singh Ni0wari police station Vijaygarh district Aligarh The offence of IPC reaches the extent of Section 188/269/171 C IPC and Epidemic Act. Sir, I request you to please register a case against the said accused and take necessary action. S.C. English U.P. Kapil Dev 24/4/21 Kapil Dev SI PS Akrawad Aligarh In the note CC 686 Yashpal Singh certifies that the copy of Tahrir has been marked as word and word."
|
26 |
|
27 |
+
Statutes:['IPC_188', 'IPC_269', 'IPC_171C', 'The_Motor_Vehicles_Act_1988_207']
|
28 |
-----
|
29 |
|
30 |
###
|
|
|
43 |
Fact Statement: ```{fact}```
|
44 |
"""
|
45 |
|
46 |
+
def generate(input_text):
|
47 |
com = prompt.format(fact=input_text)
|
48 |
print(input_text)
|
49 |
chat_completion = mistral_client.chat.completions.create(
|
50 |
# model="gpt-4-turbo",
|
51 |
model='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4',
|
52 |
+
temperature=0.3,
|
53 |
messages=[
|
54 |
{"role": "system", "content": "You are a helpful assistant who is expert in tagging FIRs with relevant statutes from IPC among other special acts."},
|
55 |
{
|
|
|
126 |
# gr.Slider(minimum=0.1,maximum=1.0,value=0.5,step=0.1),
|
127 |
],
|
128 |
outputs=gr.Textbox(label="Predicted Statutes"),
|
129 |
+
examples=[[fact_example, "English"]],
|
130 |
)
|
131 |
|
132 |
demo.launch()
|
133 |
|
134 |
|
135 |
|
136 |
+
# GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7862 gradio gradio_app.py
|
137 |
|