Draft_bail / app.py
Hidayatmahar's picture
Update app.py
d02b4fa verified
import streamlit as st
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.units import inch
# Function to generate the bail application text
def generate_bail_application(
court_name, bail_application_number, applicant_name, applicant_father_name, applicant_caste,
applicant_address, crime_number, crime_section, police_station, complainant_name,
complainant_father_name, car_details, incident_date, fir_date, illegal_act_date,
section_491_date, case_references, advocate_name, application_date
):
template = f"""
**IN THE COURT OF {court_name.upper()}.**
**Criminal Bail Application No. {bail_application_number} of 2024.**
**{applicant_name} S/o {applicant_father_name}** Adult, Muslim,
By caste {applicant_caste}
R/o {applicant_address}..................................**........Applicant(s)/Accused.**
**Versus**
The State...........................................................**Respondent.**
-----------------------------------------------------------------------
**Crime No. {crime_number} of 2024**
-----------------------------------------------------------------------
**U/S {crime_section} PPC**
**P.S; {police_station}, Hyderabad.**
-----------------------------------------------------------------------
**BAIL APPLICATION UNDER SECTION 497 CR.PC.**
It is submitted and prayed on behalf of the above-named
applicant/accused that this Honorable Court may kindly be pleased to
grant him post-arrest bail in the above crime, on consideration of the
following facts and grounds: -
**F A C T S.**
Brief facts of prosecution case as narrated in the F.I.R lodged by
complainant {complainant_name} S/o {complainant_father_name}, are that I, live at the above
mentioned address and I have a {car_details} for my
personal use which I usually park outside my house. On dated {incident_date},
I parked as usually outside my house, at 1700 evening for the sake of
check of car I found car's bonnet opened and battery of AGS company has
been stolen which we tried a lot to search but we could not find any
information.
Hence I request at PS that an unknown thief has stolen a battery from my
car.
> **GROUNDS**
1. That, there are no reasonable grounds to believe that the
applicant/accused has committed the alleged offence with which he
stands charged.
2. That, the applicant is law abiding citizen and doing labor in
Hyderabad and for earning his livehood by working on daily wages.
3. That, the allegations leveled in the FIR are concerned, they are
quite ill motivated, baseless, unwarranted and are based on
ill-founded facts, owing to some personal grudge and vendetta.
4. That, the FIR has been lodged with mala fide intention merely to
harass and get gratification from applicant's family. That, the said
FIR was lodged on **{fir_date}** and the occurrence is shown on
**{incident_date}**, such delay of two months indicates premeditated act
of complainant just to falsely apprehended and prosecute innocent
applicant.
5. That, the real facts of the case are entirely different from the
contents of FIR, as on the dated {illegal_act_date}, **at about 11.00 PM
Hours; night time** the SHO of PS {police_station} along with his
subordinate staff forcibly entered in house and spread terror by
searching house without any prior permission, they made ingress
without due care of Parda/modesity of woman house; applicant and
other family members requested them to tell reason for such sudden
and terror acts but said SHO and his subordinate staff did not
bother and listen to pay any heed and forcibly taken the
applicant/accused and while issuing threats of dire consequences.
6. That, against above such illegal act, on dated {section_491_date}, the
sister of said applicant/accused had also filed an application under
section 491 Cr.P.C as to produce detenuee from illegal detention,
however, despite of compliance, Police nominated said
applicant/accused in this fabricated FIR.
7. That, neither the applicant/accused has committed the alleged
offense nor he has any nexus with alleged offense directly or
indirectly, hence his false implication cannot be ruled out.
8. That, the applicant/accused is confined in jail and is no more
required to ploce for further investigation, therefore his further
detention in jail will serve no purpose.
9. That, the offence under which the applicant/accused is charged does
not fall within the Prohibitory clause of S. 497, Cr.P.C. hence the
grant of bail is rule and refusal is an exception in such like cases
and no exceptional ground appeared in the case to withheld the bail.
10. That, neither the name of applicant/accused is shown in said FIR,
nor any incriminating have been recovered from the possession of
applicant/accused.
11. That, the case of present applicant does not come within the
exception as provided in case of **{case_references[0]}** reported in **{case_references[1]}**
and **{case_references[2]} V/S The State reported in {case_references[3]}**.
12. That, the Honourable High Court Karachi had also held against the
impugned order of learned Ist Additional Sessions Judge, Karachi
West in case of **{case_references[4]} alias Waja (Applicant) V/S The
State**, reported in **{case_references[5]}** , that Merely
registration of the case would not disentitle the accused from the
concession of bail.
13. That, the deeper appreciation of the evidence is not permissible
while deciding a bail application and same is to be decided on basis
of the tentative assessment of the material available on the record.
On tentative assessment of the material available in this case it
appears that case of applicant requires further inquiry.
14. That, in the light of above grounds the case of the applicant/
accused requires further probe as contemplated in Section 497
Cr.P.C. for further enquiry.
15. That, the law for the purpose of bail cannot be stretched in favour
of prosecution and if any benefit of doubt arises even at the bail
stage, it must go to the accused.
16. That, the bail should not be refused as a punishment, the principle
based on natural justice is that any possible wrong at the bail
stage could be cured at the time of final judgment by convicting the
accused if he is found guilty but any wrong committed by refusing
bail and putting him into jail custody could not be cured if he is
found innocent.
17. That, the further law points and grounds will be raised/ agitated at
the time of hearing of this bail application with permission of this
Honorable Court.
18. That, there is no likelihood of ascendance or tampering with
prosecution evidence.
19. That, the applicant/accused is ready to furnish reasonable surety to
the satisfaction of the Honorable Court.
> That, the grant of prayer would meet the ends of justice.
**HYDERABAD**
**Dated: {application_date}. ADVOCATE FOR APPLICANT/ACCUSED.**
"""
return template
# Function to create PDF
def create_bail_application_pdf(filename, content):
doc = SimpleDocTemplate(filename, pagesize=letter)
styles = getSampleStyleSheet()
story = []
# Add content to the PDF
story.append(Paragraph(content, styles['Normal']))
doc.build(story)
# Streamlit App
st.title("Bail Application Generator")
# Input fields
court_name = st.text_input("Court Name", "VIIITH JUDICIAL MAGISTRATE, HYDERABAD")
bail_application_number = st.text_input("Bail Application Number", "156")
applicant_name = st.text_input("Applicant Name", "Ayaz Gul")
applicant_father_name = st.text_input("Applicant's Father Name", "Lal Gul")
applicant_caste = st.text_input("Applicant's Caste", "Mari Baloch")
applicant_address = st.text_input("Applicant's Address", "Mohallah Mir Fateh Colony Hussainabad District Hyderabad")
crime_number = st.text_input("Crime Number", "156")
crime_section = st.text_input("Crime Section", "379")
police_station = st.text_input("Police Station", "Hussainabad")
complainant_name = st.text_input("Complainant Name", "Faiz Ullah")
complainant_father_name = st.text_input("Complainant's Father Name", "Ubedullah")
car_details = st.text_input("Car Details", "Mehran car registered No. AZS; 909")
incident_date = st.text_input("Incident Date", "27-06-2024")
fir_date = st.text_input("FIR Date", "15.09.2024")
illegal_act_date = st.text_input("Illegal Act Date", "14.09.2024")
section_491_date = st.text_input("Section 491 Date", "20.09.2024")
case_references = [
st.text_input("Case Reference 1", "Tariq Bahir"),
st.text_input("Case Reference 2", "PLD 1995 SC 34"),
st.text_input("Case Reference 3", "Muhammad Eden"),
st.text_input("Case Reference 4", "2022 PcrLJ 143"),
st.text_input("Case Reference 5", "Muhammad Nizam"),
st.text_input("Case Reference 6", "Cr.Bail application 1179/2024"),
]
advocate_name = st.text_input("Advocate Name", "ADVOCATE FOR APPLICANT/ACCUSED")
application_date = st.text_input("Application Date", "10-10-2024")
# Generate Bail Application
if st.button("Generate Bail Application"):
bail_application = generate_bail_application(
court_name, bail_application_number, applicant_name, applicant_father_name, applicant_caste,
applicant_address, crime_number, crime_section, police_station, complainant_name,
complainant_father_name, car_details, incident_date, fir_date, illegal_act_date,
section_491_date, case_references, advocate_name, application_date
)
# Display the generated application
st.markdown(bail_application)
# Create and download PDF
pdf_filename = "bail_application.pdf"
create_bail_application_pdf(pdf_filename, bail_application)
with open(pdf_filename, "rb") as f:
st.download_button("Download PDF", f, file_name=pdf_filename)