Tejasw1 commited on
Commit
d879afc
·
verified ·
1 Parent(s): 8752903

Upload folder using huggingface_hub

Browse files
__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
- fact = '''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.'''
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:"It is submitted that yesterday on 29/4/21, in the three-tier election, I have been on duty of U.P. Zone-2, whose headquarters is Police Station Vijaygarh, Sector No. 09 of which the headquarters is Pvt. Bhinauli. I was engaged as sector incharge along with Sector Magistrate Shri Dinesh Kumar. Primary School Kanakpur Primary School Gudmai, Primary School Bhinauli Primary School Bistauli and Pre-Secondary School Bistauli respectively. At 9.42 am, I received a call from HG Sanjay Kumar, posted at Kanakpur Primary School, about a quarrel on which I was going to village Gudmai with his Sector Magistrate at that time. Leaving them there, I immediately left for village Kanakpur, as soon as I reached village Kanakpur, I saw that they were distributing slips by laying bags with the candidates near the polling booth. Due to which there is a crowd there. On their previous visit to the village, all of them were instructed to put bags 200 meters away from the polling booth, the crowd present there had also blocked the narrow road to the village by putting their cars and bicycles. As soon as I reached there, the crowd started dispersing and the polling agents started picking up their bags and started removing their vehicles from there. And when the election system started becoming normal, my eyes fell on the house built next to the polling booth outside which the agents were sitting with bags. This house belonged to Rakesh Kumar son of Turi Singh and the polling agents who were crowded there were sitting in the bag of candidate Prempal son of Shriman Singh. Mohit Kumar, son of Rakesh Kumar (above), had gathered the crowd by setting up a sugarcane juice stall on the same house. To control the crowd, I used minimum necessary force to close Mohit's sugarcane juice stall and asked the agents sitting at his house to lift the bag. While I was taking this action, the landlord Rakesh Kumar came UP13W0027 with his Bolero number above and put the car from where I was removing the crowd. When asked to remove it, Mohit Kumar and Yogesh Kumar, who were present there, got into a scuffle with me while abusing, I tried to remove the key of the car for the purpose of sealing it, then Rakesh climbed the glass of the car so that my right hand got stuck in it, which also hurt my hand. He snatched the key from my hand and lowered the glass till then my companions HG Prakash Chandra and HG Keshav Singh came there, as soon as my companions reached me for my help, Rakesh Kumar got down by putting the above Bolero car in the middle of the road there and his sons Mohit and Yogesh Kumar got angry with me, Rakesh shouted that today he will be robbed by his pistol. Let's make it. On his instigation to kill me in this way, his two sons Mohit and Yogesh started trying to snatch my pistol and took it out of the holster and also damaged my uniform, till then HG Sanjay Kumar and the guard appointed with him came out running after hearing the noise and saved me and my pistol. I request you to register a case against Rakesh Kumar son of Turi Singh and Mohit Kumar and Yogesh Kumar son of Rakesh Kumar for committing serious crimes like obstructing the government work being done by me UP, abusing, threatening to kill and trying to snatch the government pistol. SD English Shashank Kaushik U.P. 30/4/21 Shashank Kaushik (U.P.) PNO 182025017 Police Station Akrabad District Aligarh Mob 9161222231 Note I CC 551 Sanjeev Kumar certify that the copy of Tahrir has been inscribed on the word 'B' on the compute."
27
 
28
- Statutes:['IPC_186', 'IPC_353', 'IPC_506', 'IPC_332']
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,temperature=0.1):
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=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=[[fact, "English"]],
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