|
|
import streamlit as st |
|
|
import torch |
|
|
from transformers import DistilBertTokenizer, DistilBertForQuestionAnswering |
|
|
|
|
|
def find_answer(question, context, model, tokenizer): |
|
|
|
|
|
inputs = tokenizer.encode_plus(question, context, add_special_tokens=True, return_tensors="pt", max_length=512, truncation=True) |
|
|
input_ids = inputs["input_ids"] |
|
|
|
|
|
|
|
|
input_ids = input_ids[:, :512] |
|
|
|
|
|
|
|
|
with torch.no_grad(): |
|
|
output = model(**inputs) |
|
|
|
|
|
start_logits = output['start_logits'] |
|
|
end_logits = output['end_logits'] |
|
|
|
|
|
|
|
|
start_idx = torch.argmax(start_logits, dim=1).item() |
|
|
end_idx = torch.argmax(end_logits, dim=1).item() |
|
|
|
|
|
|
|
|
answer = tokenizer.decode(input_ids[0, start_idx:end_idx+1], skip_special_tokens=True) |
|
|
return answer |
|
|
|
|
|
def main(): |
|
|
st.title("Shree5 GPT: By Tech Ninja Group") |
|
|
|
|
|
text = st.text_area('Enter your citizenship-related question:', max_chars=512) |
|
|
|
|
|
|
|
|
model_name = "distilbert-base-uncased" |
|
|
tokenizer = DistilBertTokenizer.from_pretrained(model_name) |
|
|
model = DistilBertForQuestionAnswering.from_pretrained(model_name) |
|
|
|
|
|
context = """ |
|
|
[CLS] Nepal Citizenship Rules, 2063 (2006) Date of Publication in Nepal Gazette 2063.8.29 (15 Dec. 2006) Amendment Nepal Citizenship (First Amendment) Rules, 2063 2063.10.15 (29 Jan. 2007) In exercise of the powers conferred by Section 23 of the Nepal Citizenship Act, 2006, Government of Nepal has framed the following Rules: [SEP] |
|
|
[CLS] Short title and commencement: (1) These rules may be called the "Nepal Citizenship Rules, 2063 (2006)." (2) These Rules shall commence immediately. Definitions: Unless the subject or the context otherwise requires, in this Rules ,- (a) "Act" means the Nepal Citizenship Act, 2063 (2006). (b) "Ministry" means Ministry of Home Affairs, Government of Nepal. (c) "Local Body" means the Village Development Committee or Municipality formed pursuant to the laws in force; and this term also includes the Sub-municipal Corporation and Municipal Corporation. [SEP] |
|
|
[CLS] Procedures for obtaining certificate of citizenship of Nepal by descent: (1) A citizen of Nepal, who has completed the age of Sixteen years and intends to obtain the certificate of citizenship of Nepal by descent, has to make an application, in the format referred to in Schedule-1, and accompanied by the following documents, to the concerned Chief District Officer: (a) The certificate of citizenship of Nepal of his or her father or mother or relative within three generations of his or her lineage, (b) A recommendation made by the concerned Local Body setting out his or her birth place and relationship or a certificate of birth registration, (c) In the case where the certificate of citizenship of a relative within three generations of his or her lineage has been submitted pursuant to Clause (a), a relationship certificate setting out the relationship with that relative. (2) The certificate of citizenship of Nepal may, based on the following documents, be provided to a citizen of Nepal who fails to submit the evidence referred to in Sub-rule (1) along with the application: (a) An on the spot deed of public inquiry, in the format referred to in Schedule-3, executed by local inhabitants, who have obtained the certificate of citizenship of Nepal, in presence of a representative of the Local Body, setting out that the applicant is a citizen of Nepal by descent by virtue of that his father or mother is a citizen of Nepal and that he or she was born in Nepal and has been residing permanently within the territory of Nepal continuingly, (b) Identification, in the format referred to in Schedule-4, made on the spot by three citizens of Nepal, who reside in the concerned Ward and have obtained the certificate of citizenship of Nepal. Provided that, if the authority making recommendation for citizenship or providing citizenship considers that the identifying persons have made identification doubtfully, such an authority may make further inquiry into the matter. (3) If a person who was found within the territory of Nepal and has completed the age of Sixteen years but the whereabouts of his or her father or mother are not known intends to obtain the certificate of citizenship of Nepal, such a person has to make an application, in the format referred to in Schedule-1, accompanied by the following documents, to the concerned Chief District Officer: (a) Where such a person has been brought up by a children home or orphan children protection organization or association or orphanage which has obtained approval from the Government of Nepal, the recommendation of such a home, organization, association or orphanage, (b) Where any person has obtained guardianship of and maintained and subsisted that person in accordance with the laws in force, a copy of the certificate of citizenship of such a person, (c) Identification made by the chief of organization maintaining and subsisting that person in the organization referred to in Clause (a) or by the person maintaining and subsisting that person pursuant to Clause (b). (4) If it is required to further inquire into the matter in relation to the fatherhood or motherhood of the applicant pursuant to Sub-rule (3), a recommendation of the Local Body or police report may be required, as per necessity. (5) If, in examining the application received pursuant to Sub-rule(1) or (3), the applicant is found to be eligible to obtain the certificate of citizenship of Nepal by descent, the certificate of citizenship of Nepal by descent may be issued to him or her. (6) The column of the certificate of citizenship of the person, whose fatherhood or motherhood has not been settled, where the name of father or mother is to be specified shall indicate the matter that the fatherhood or motherhood has not been traced out and specify the name, surname and address of the guardian. (7) The certificate of citizenship may be issued also based on the registration records prepared by and provisional slips distributed by the citizenship teams deputed from time to time prior to the commencement of this Rule. (8) The list of persons who make application for the certificate of citizenship of Nepal pursuant to Sub-rule (2) has to be made public on the same day. [SEP] |
|
|
[CLS] Procedures for obtaining the certificate of citizenship of Nepal by birth: (1) If a citizen of Nepal who has completed the age of Sixteen years intends to obtain the certificate of citizenship of Nepal by birth pursuant to Sub-section (1) of Section 4 of the Act, such a citizen shall have to make an application, accompanied by the following documents, to the concerned Chief District Officer, in the format referred to in Schedule-1: (a) A recommendation made by the concerned Local Body setting out the matter that the applicant was born within Nepal and has been permanently residing in Nepal continuingly, (b) Land ownership registration certificate or tenancy right certificate or household certificate in his or her name or in the name of his or her family or an evidence indicating the inclusion of his or her name or his or her father s or mother s name in the electoral rolls prepared by the Election Commission. Explanation: For the purposes of this Clause, "family" includes father, mother, step mother, son, unmarried daughter and also daughter-in-law whether living in an undivided family or living separately. (2) A person who intends to obtain the certificate of citizenship pursuant to Sub-rule (1) shall have to make an application to the Chief District Officer prior to the election of the Constituent Assembly. (3) The certificate of citizenship of Nepal may, pursuant to Sub- section (4) of Section 8 of the Act, and based on the following documents, be provided to a citizen of Nepal who fails to submit the evidence referred to in Sub-rule (1) along with the application: (a) An on the spot deed of public inquiry, in the format referred to in Schedule-5, executed by local inhabitants, who have obtained the certificate of citizenship of Nepal, in presence of a representative of the Local Body, setting out that the applicant was born in Nepal and has been residing permanently within the territory of Nepal continuingly, (b) Identification, in the format referred to in Schedule-4, made on the spot by three citizens of Nepal, who reside in the concerned Ward and have obtained the certificate of citizenship of Nepal. Provided that, if the authority making recommendation for citizenship or providing citizenship considers that the identifying persons have made identification doubtfully, such an authority may make further inquiry into the matter. (4) The Chief District Officer shall have to make decision on the applications received within the period referred to in Sub-section (3) of Section 4 of the Act within One month from the date of registration of such applications. (5) If, in examining the application received pursuant to Sub-rule (1) or (3), the applicant is found to be eligible to obtain the certificate of citizenship of Nepal by birth, the certificate of citizenship of Nepal by birth may be issued to him or her (6) The list of persons who make application for the certificate of citizenship of Nepal pursuant to Sub-rule (3) has to be made public on the same day. [SEP] |
|
|
[CLS] Procedures for obtaining certificate of naturalized citizenship of Nepal on the basis of matrimonial relationship: (1) If a foreign woman who has matrimonial relationship with a citizen of Nepal intends to obtain the citizenship of Nepal, she has to make an application, accompanied by the following documents, to the concerned Chief District Officer, in the format referred to in Schedule-7: (a) A recommendation made by the concerned Local Body specifying the matrimonial relationship with the citizen of Nepal, (b) A proof showing that action has been instituted by her to renounce the foreign citizenship. (2) If, in examining the application received pursuant to Sub-rule (1), the applicant is found to be eligible to obtain the certificate of naturalized citizenship of Nepal, the certificate of naturalized citizenship of Nepal may be issued to her. [SEP] |
|
|
[CLS] Information to be given to applicant: If, in examining application received pursuant to Rule 3 or 4, any applicant is found ineligible to obtain the certificate of citizenship of Nepal, a decision has to be made to that effect and information given to the applicant within seven days. [SEP] |
|
|
[CLS] Other procedures for obtaining certificate of naturalized citizenship of Nepal: (1) In the case of an offspring born to a woman citizen of Nepal who has got married to a foreign citizen, an application, accompanied by the following documents, has to be made to the Chief District Officer, in the format referred to in Schedule-7: (a) A copy of the certificate of citizenship of Nepal of the mother, (b) A recommendation made by the concerned Local Body setting out that he or she was born in Nepal and has been permanently residing in Nepal, (c) A proof that he or she has not obtained the citizenship of a foreign country on the basis of his or her father's citizenship. (2) If any foreign citizen who has fulfilled the terms and conditions set forth in Sub-section (4) of Section 5 of the Act intends to acquire the citizenship of Nepal, he or she has to make an application, accompanied by the recommendation of the Local Body related with his or her abode, to the concerned Chief District Officer, in the format referred to in Schedule-7. (3) On receipt of an application pursuant to Sub-rule (1) or (2), the Chief District Officer may, if he or she considers necessary, inquire the Mayor of the concerned Municipality or Chairperson of the Village Development Committee into the matter and, if the applicant is found to have fulfilled the terms and conditions set forth in Sub-section (4) of Section 5 of the Act, forward the application, along with his or her opinion, to the Ministry. (4) Upon making examination of the application received pursuant to Sub-rule (3), the Ministry may provide the certificate of naturalized citizenship of Nepal in the format referred to in Schedule-8. (5) If, out of the offspring of the person who has acquired the naturalized citizenship of Nepal pursuant to Sub-section (5) of Section 5 of the Act, any offspring who was born prior to the acquisition of such citizenship by that person intends to acquire the naturalized citizenship of Nepal, he or she may make an application to the concerned Chief District Officer in the format referred to in Schedule-7. The application has to be accompanied by a relationship certification letter, a copy of the father's or mother's certificate of citizenship and a recommendation made by the Local Body that he or she has been residing in Nepal. (6) If, in examining any application received pursuant to Sub-rule (5), the applicant is found to be eligible to obtain the certificate of naturalized citizenship, the certificate of naturalized citizenship may be issued to him or her. [SEP] |
|
|
[CLS] Authority to issue certificate of citizenship: (1) The Chief District Officer shall have the power to issue the certificate of citizenship of Nepal by descent, by birth, by the reason of matrimonial naturalized and certificate of naturalized citizenship of Nepal to those offspring of a person having obtained naturalized citizenship of Nepal who were born prior to the obtaining of such citizenship by that person. (2) The Chief District Officer may delegate the powers conferred to him or her under Sub-rule (1) to his or her subordinate officer employee or to the chief of a team deputed by the Government of Nepal to distribute citizenship, from time to time. (3) ................. (4) The Ministry shall have the power to issue the certificate of naturalized citizenship of Nepal other than that set forth in Sub-rule (1). (5) The Council of Ministers, Government of Nepal, shall have the power to grant the honorary citizenship of Nepal to be granted pursuant to Section 6 of the Act. (6) After a decision has been made to grant citizenship pursuant to Sub-rule (5), the Ministry shall issue the certificate of honorary citizenship of Nepal. (7) The authority issuing the certificate of citizenship pursuant to these Rules shall issue the certificate of citizenship of Nepal by descent or by birth in the format referred to in Schedule-2 and the certificate of naturalized citizenship of Nepal in the format referred to in Schedule-8. [SEP] |
|
|
[CLS] Procedures for renouncing citizenship of Nepal: (1) If any citizen of Nepal intends to renounce the citizenship of Nepal, he or she shall have to give information thereof, accompanied by the original copy of the certificate of citizenship of Nepal, in the format referred to in Schedule-9, to the concerned Chief District Officer if he or she is domiciled within Nepal and to the concerned Nepalese ambassador or the chief of Nepalese mission or the consul general or the consul if he or she is domiciled in a foreign country. ? Amended by the First Amendment. ? Deleted by the First Amendment. (2) Where information has been given abroad pursuant to Sub-rule (1), the Nepalese ambassador or the chief of Nepalese mission or the consul general or the consul shall forward the full details thereof to the Ministry through the Ministry of Foreign Affairs within seven days. (3) The Ministry shall forward the information received pursuant to Sub-rule (2) to the concerned Chief District Officer. (4) On receipt of the information pursuant to Sub-rule (1), the Chief District Officer shall register such information in the register maintained in the format referred to in Schedule-10; and the citizenship of Nepal of such person shall cease to exist from the date of such registration. [SEP] |
|
|
[CLS] Decision making authority: If there arises a question of whether a citizen of Nepal has acquired the citizenship of a foreign country pursuant to Sub-section (5) of Section 10 of the Act, the Ministry shall decide that question. [SEP] |
|
|
[CLS] Procedures for resumption of citizenship of Nepal: (1) If any person who has renounced the citizenship of Nepal pursuant to Section 11 of the Act and gone abroad intends to acquire the citizenship of Nepal again, such a person shall have to make an application, in the format referred to in Schedule-11, accompanied by a proof showing the renunciation of foreign citizenship, to the Ministry or the concerned Chief District Officer that has previously issued the certificate of citizenship to that person. (2) On receipt of an application with information referred to in Sub-rule (1), the authority referred to in Rule 8 shall give information of the registration of that information in the format referred to in Schedule-12 and issue the certificate of citizenship of Nepal containing the same details as mentioned in the previous certificate of citizenship. [SEP] |
|
|
[CLS] Procedures for revocation of certificate of citizenship: If it is proved that any person has obtained the certificate of citizenship of Nepal by giving false details pursuant to Section 12 of the Act, the following authority shall revoke such a certificate of citizenship of Nepal: (a) The Ministry, if the certificate was issued by it, (b) The concerned Chief District Office, if the certificate was issued by the District Administration Office or other body, (c) Information along with the details of the certificate of citizenship of Nepal revoked by the Chief District Officer pursuant to Clause (b) shall be forwarded to the Regional Administration Office and the Ministry. [SEP] |
|
|
[CLS] Records of certificate of citizenship to be maintained: The records of the certificate of citizenship as referred to in Section 15 of the Act shall be maintained as follows: (a) Details relating to citizenship shall be recorded and maintained systematically, and such details may also be maintained in electronic means. (b) The District Administration Offices shall have to forward monthly details of the distribution of the certificates of citizenship to the Regional administration Office and the Ministry. [SEP] |
|
|
[CLS] Procedures for correction of details: (1) A person who intends to get corrected any matter contained in the certificate of citizenship of Nepal pursuant to Sub-sections (1) and (3) of Section 17 of the Act has to make an application to the Ministry or the Chief District Officer. (2) If an application is made pursuant to Sub-rule (1), the Ministry or the Chief District Officer may, upon making necessary inquiry into the matter, take back the certificate of citizenship previously issued and provide another certificate of citizenship, as amended, pursuant to Sub-section (2) of Section 17 of the Act. [SEP] |
|
|
[CLS] Power to depute citizenship teams: (1) The Government of Nepal may depute teams for the distribution of the certificates of citizenship pursuant to Sub-section (1) of Section 22 of the Act. (2) In deputing a team pursuant to Sub-rule (1), the team shall be deputed in such a way that its chief is at least gazetted third class employee and it consists of other employees of the civil service itself. (3) A team deputed pursuant to Sub-rule (1) shall distribute the certificates of citizenship of Nepal, subject to the direction given by the Government of Nepal pursuant to Sub-section (2) of Section 22 of the Act. (4) A person who is not satisfied with the decision made by the team deputed pursuant to Sub-rule (1) not to issue the certificate of citizenship of Nepal may make an application to the concerned Chief District Officer within thirty days. The decision made by the Chief District Officer in this respect shall be final. (5) The certificate of citizenship distribution team shall collect and maintain records of the minors who have not obtained the certificate of citizenship and the persons who have become major and are eligible to acquire citizenship but who could not obtain the certificate of citizen while the team was in mission. [SEP] |
|
|
[CLS] Procedures for obtaining certificate of citizenship by the family member of employee: (1) If the family of any employee intends to obtain the certificate of citizenship of Nepal from the District Administration Office in the district where such employee is in service, he or she has to make an application, in the format referred to in Schedule-1, accompanied by the following documents, to the Chief District Officer: (a) The certificate of citizenship of Nepal of his or her father or mother, (b) A recommendation by the office where the employee is in service, (c) In the case of a married woman, the certificate of citizenship of her husband and the marriage registration evidence. (2) The office issuing the citizenship shall issue the certificate of citizenship based on the documents received pursuant to Sub-rule (1), maintain the records of the certificate of citizenship so granted in that office and also give information thereof to the District Administration Office of the district where the concerned employee has permanent address. Explanation: (1) For the purposes of this Rule, "employee" means an employee whose salary and allowance is paid from the funds of the Government of Nepal or an employee of a corporation or a teacher or professor. (2) "Family" means the husband, wife, son, unmarried daughter, adopted son, unmarried adopted daughter, father, mother or step mother of the employee referred to in Clause (1) who lives with, and has to be maintained by the employee, and this term also includes, in the case of a male employee and unmarried woman employee, his or her grand-father and grand-mother, and in the case of a married employee, his or her mother-in-law and father-in-law. [SEP] |
|
|
[CLS] Provisions relating to directives and procedures: The Ministry may, subject to the Act and this Rule, issue necessary directives and frame and enforce procedures, as required. [SEP] |
|
|
[CLS] Power to alter Schedules: The Government of Nepal may, by a Notification in the Nepal Gazette, make amendment or alteration in the Schedules, as required. [SEP] |
|
|
""" |
|
|
if text: |
|
|
answer = find_answer(text, context, model, tokenizer) |
|
|
|
|
|
if answer: |
|
|
st.markdown(f"**Answer:** {answer}") |
|
|
else: |
|
|
st.markdown("No answer found in the provided context for the given question.") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|