Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
from sentence_transformers import SentenceTransformer, util | |
import easyocr | |
import os | |
# Predefined questions and answers | |
def load_predefined_qa(): | |
return [ | |
{ | |
"question": "What types of cases do commercial courts handle?", | |
"answer": "Commercial courts specialize in resolving disputes that arise from commercial transactions, such as breach of contracts, disputes between shareholders, intellectual property issues, and matters related to banking, insurance, and financing agreements. They also address disputes involving joint ventures, supply chain agreements, franchising, construction projects, and mergers and acquisitions. These courts aim to provide efficient and streamlined resolutions to disputes, reducing delays and ensuring businesses can continue operating without prolonged legal entanglements." | |
}, | |
{ | |
"question": "What is the process for filing a case in a commercial court?", | |
"answer": "Filing a case in a commercial court involves drafting a plaint that outlines the details of the dispute, the claims being made, and the relief sought. The plaint must include all supporting evidence, such as contracts, emails, invoices, or any other relevant documents. The plaintiff must pay the requisite court fees, which are calculated based on the value of the claim. Before filing, parties are required to attempt pre-institution mediation unless an urgent interim relief is being sought. If the mediation fails, the case can then be formally filed in the commercial court." | |
}, | |
{ | |
"question": "What is the jurisdiction of commercial courts in India?", | |
"answer": "Commercial courts in India are empowered to handle cases that involve commercial disputes valued above a specified monetary threshold, typically Rs. 3 lakhs. Their jurisdiction covers disputes under laws such as the Arbitration and Conciliation Act, intellectual property laws, the Companies Act, and other statutes governing commercial transactions. Geographically, commercial courts are established in districts where significant commercial activities occur, ensuring accessibility for businesses operating in those regions." | |
}, | |
{ | |
"question": "What is the timeline for resolving cases in commercial courts?", | |
"answer": "Under the Commercial Courts Act, 2015, cases should ideally be resolved within six months from the date of the first case management hearing. This timeline is enforced through strict procedural rules and active case management by the court. However, in practice, delays can occur due to the complexity of cases or the volume of pending matters. Courts are required to document reasons for delays and take steps to expedite resolution where possible." | |
}, | |
{ | |
"question": "Can parties appeal decisions made by commercial courts?", | |
"answer": "Yes, parties can appeal judgments passed by commercial courts. Appeals must be filed within 60 days of the judgment and are heard by the Commercial Appellate Division of the High Court. The appellate court examines the legal validity of the decision but typically does not re-evaluate the factual findings unless a significant error is identified. This ensures that the appellate process is efficient and does not undermine the objective of speedy dispute resolution." | |
}, | |
{ | |
"question": "What is pre-institution mediation in commercial courts?", | |
"answer": "Pre-institution mediation is a mandatory process introduced by the Commercial Courts Act, 2015, to encourage parties to resolve disputes amicably before resorting to litigation. It is conducted by trained mediators in a time-bound manner, typically within 90 days. If the parties reach an agreement, the settlement is legally binding. If not, the case can proceed to the commercial court. Pre-institution mediation aims to save time and reduce the burden on courts while fostering a cooperative approach to dispute resolution." | |
}, | |
{ | |
"question": "What is the monetary threshold for cases in commercial courts?", | |
"answer": "The monetary threshold for commercial court cases was initially set at Rs. 1 crore but has since been reduced to Rs. 3 lakhs to make these courts more accessible to businesses with smaller disputes. This change reflects the government's commitment to promoting ease of doing business and ensuring that even small and medium-sized enterprises (SMEs) can benefit from specialized legal mechanisms." | |
}, | |
{ | |
"question": "How do commercial courts handle intellectual property disputes?", | |
"answer": "Commercial courts handle intellectual property disputes with a focus on ensuring the swift protection of IP rights. Cases involving trademarks, copyrights, patents, and trade secrets are adjudicated under specific statutory frameworks, such as the Copyright Act and the Patents Act. These courts often grant interim relief, such as injunctions, to prevent ongoing infringement while the case is being decided. They also prioritize expert testimony to understand the technical aspects of IP disputes." | |
}, | |
{ | |
"question": "What is the role of the Commercial Courts Act, 2015?", | |
"answer": "The Commercial Courts Act, 2015, established a framework for specialized courts to handle commercial disputes. Its objectives are to enhance the efficiency of dispute resolution, reduce delays, and promote ease of doing business. Key features include strict timelines, mandatory pre-institution mediation, and case management systems. The Act also amends the Code of Civil Procedure to introduce provisions tailored for commercial litigation, such as summary judgments and expedited hearings." | |
}, | |
{ | |
"question": "What is a summary judgment in commercial courts?", | |
"answer": "A summary judgment allows the court to decide a case without a full trial when it determines that there are no genuine issues of material fact to be resolved. Either party can apply for a summary judgment by demonstrating that the opposing party's claims or defenses lack sufficient evidence. This mechanism helps in quickly resolving cases that do not require extensive examination of evidence, thereby saving time and resources for both the parties and the court." | |
}, | |
{ | |
"question": "What documents are required to file a case in a commercial court?", | |
"answer": "To file a case in a commercial court, you need to submit a plaint detailing the nature of the dispute, the claims being made, and the relief sought. Accompanying documents may include contracts, correspondence, invoices, proof of payments, minutes of meetings, and any other evidence supporting the claim. These documents must be authenticated and filed within the timelines specified under the amended Code of Civil Procedure. The court may dismiss cases where documents are not adequately provided." | |
}, | |
{ | |
"question": "What is the role of case management in commercial courts?", | |
"answer": "Case management involves the proactive scheduling and monitoring of cases by the court to ensure that they are resolved within prescribed timelines. During case management hearings, the court sets deadlines for filing documents, completing discovery, and presenting arguments. This process minimizes procedural delays and ensures that both parties are adequately prepared for trial. It also helps the court prioritize cases and allocate resources effectively." | |
}, | |
{ | |
"question": "Can arbitration disputes be brought before commercial courts?", | |
"answer": "Yes, arbitration disputes can be brought before commercial courts in specific circumstances. For instance, parties may approach the court to enforce an arbitral award or to challenge the validity of an arbitration agreement. The Commercial Courts Act provides for the expeditious disposal of such matters, ensuring that arbitration remains an efficient alternative to litigation while also benefiting from judicial oversight where necessary." | |
}, | |
{ | |
"question": "How do commercial courts ensure faster resolution of disputes?", | |
"answer": "Commercial courts ensure faster resolution through several mechanisms, such as mandatory pre-institution mediation, strict adherence to timelines, and the use of case management systems. They also allow for summary judgments and restrict adjournments to exceptional circumstances. The procedural amendments introduced by the Commercial Courts Act prioritize efficiency while ensuring fairness in adjudication." | |
}, | |
{ | |
"question": "What is the Commercial Appellate Division?", | |
"answer": "The Commercial Appellate Division is a specialized bench within the High Court that hears appeals from commercial courts. It focuses on ensuring consistency and uniformity in the application of commercial laws. The division is expected to dispose of appeals within six months, emphasizing the need for expediency in resolving disputes. It provides an additional layer of scrutiny to ensure that decisions made by commercial courts are legally sound." | |
}, | |
{ | |
"question": "What are the rules for electronic filing in commercial courts?", | |
"answer": "Electronic filing in commercial courts allows parties to submit pleadings, applications, and evidence online, streamlining the litigation process. The e-filing system reduces paperwork, enhances accessibility, and ensures that documents are securely stored and easily retrievable. Parties are required to adhere to specific formatting and authentication requirements when submitting documents electronically." | |
}, | |
{ | |
"question": "Are there special rules for evidence in commercial courts?", | |
"answer": "Yes, evidence in commercial courts must be presented concisely and in accordance with the rules prescribed under the amended Code of Civil Procedure. Parties are required to file affidavits detailing their evidence and ensure that all documents are authenticated. Cross-examinations and expert testimonies are also structured to minimize delays and focus on the core issues of the dispute." | |
}, | |
{ | |
"question": "What happens if the pre-institution mediation fails?", | |
"answer": "If pre-institution mediation fails to resolve the dispute, the mediator issues a certificate of non-settlement. This certificate allows the plaintiff to proceed with filing the case in a commercial court. While mediation is aimed at fostering amicable settlements, the failure of the process does not prejudice the parties' right to seek judicial intervention." | |
}, | |
{ | |
"question": "What is the process for enforcing a commercial court judgment?", | |
"answer": "Enforcing a judgment from a commercial court involves filing an execution petition in the same court. The court may issue orders to attach the judgment debtor's property, garnish bank accounts, or take other measures to ensure compliance with the judgment. Failure to comply with enforcement orders can result in penalties or contempt proceedings against the defaulting party." | |
}, | |
{ | |
"question": "What are the penalties for non-compliance with court orders in commercial courts?", | |
"answer": "Non-compliance with court orders can result in penalties, including fines, adverse cost orders, and in severe cases, contempt proceedings. The court may also strike out pleadings or pass adverse judgments against the non-compliant party. These measures aim to ensure that parties adhere to procedural rules and respect the authority of the court." | |
}, | |
{ | |
"question": "What is the significance of commercial courts for businesses?", | |
"answer": "Commercial courts provide a specialized forum for businesses to resolve disputes efficiently and effectively. They are staffed with judges trained in commercial law, ensuring a better understanding of business complexities. This specialization reduces delays and enhances the quality of judgments. By fostering a reliable legal environment, commercial courts help boost investor confidence and promote ease of doing business in India." | |
}, | |
{ | |
"question": "What is the role of expert witnesses in commercial court proceedings?", | |
"answer": "Expert witnesses play a critical role in commercial court proceedings by providing specialized knowledge and opinions on technical or complex matters. For example, in intellectual property disputes, experts may testify on patent validity or infringement. Their input helps judges understand industry-specific practices, technical details, or financial implications, enabling informed decision-making. The credibility and qualifications of expert witnesses are often scrutinized during cross-examination." | |
}, | |
{ | |
"question": "What is the impact of the Commercial Courts Act on ease of doing business in India?", | |
"answer": "The Commercial Courts Act has significantly improved the ease of doing business in India by creating a streamlined mechanism for resolving commercial disputes. By reducing litigation timelines and introducing mandatory mediation, the Act ensures quicker resolutions. The establishment of dedicated commercial courts has enhanced predictability and fairness in dispute resolution, encouraging both domestic and international businesses to invest in India." | |
}, | |
{ | |
"question": "What procedural changes were introduced by the Commercial Courts Act, 2015?", | |
"answer": "The Commercial Courts Act, 2015, introduced several procedural changes to expedite dispute resolution. These include case management hearings, summary judgments, limited adjournments, and stricter timelines for filing pleadings. It also mandates pre-institution mediation for eligible cases. These measures ensure that commercial disputes are resolved efficiently without unnecessary delays, aligning with global best practices in commercial litigation." | |
}, | |
{ | |
"question": "Can foreign parties litigate in Indian commercial courts?", | |
"answer": "Yes, foreign parties can litigate in Indian commercial courts if the dispute arises from commercial activities conducted in India or if the agreement specifies India as the jurisdiction. Indian commercial courts handle disputes involving foreign contracts, joint ventures, intellectual property, and more. The procedural framework ensures fair treatment for foreign litigants, and judgments are enforceable under applicable international treaties, such as the Hague Convention." | |
}, | |
{ | |
"question": "What are the challenges faced by commercial courts in India?", | |
"answer": "Despite their benefits, commercial courts face challenges such as infrastructure constraints, lack of adequate training for judicial officers, and delays due to the volume of cases. Additionally, some parties exploit procedural loopholes to prolong litigation. To address these issues, ongoing reforms focus on increasing judicial capacity, improving digital infrastructure, and strengthening the enforcement of procedural rules." | |
}, | |
{ | |
"question": "How does the Commercial Courts Act interact with arbitration laws?", | |
"answer": "The Commercial Courts Act complements arbitration laws by providing a forum for the enforcement of arbitral awards and resolving disputes related to arbitration agreements. For instance, parties can approach commercial courts to challenge arbitral awards on specific grounds under the Arbitration and Conciliation Act, 1996. This interaction ensures a seamless resolution of disputes, whether through arbitration or litigation." | |
}, | |
{ | |
"question": "Are there provisions for online hearings in commercial courts?", | |
"answer": "Yes, many commercial courts in India have adopted online hearings, especially after the COVID-19 pandemic. Virtual courtrooms enable parties to present their cases remotely, saving time and reducing costs. Documents and evidence can be submitted electronically, and proceedings are conducted via video conferencing. This digital shift has improved accessibility and efficiency in commercial litigation." | |
}, | |
{ | |
"question": "What is the role of a commercial judge in case management?", | |
"answer": "A commercial judge plays a proactive role in managing cases to ensure timely resolution. During case management hearings, the judge sets clear timelines for filing pleadings, completing discovery, and presenting arguments. The judge also decides on the admissibility of evidence and limits unnecessary procedural delays, such as repeated adjournments. This hands-on approach ensures a streamlined and efficient litigation process." | |
}, | |
{ | |
"question": "What are the remedies available in commercial court judgments?", | |
"answer": "Remedies in commercial court judgments include compensatory damages, specific performance of contracts, injunctions, and declaratory reliefs. For instance, a court may order the payment of damages for breach of contract or issue an injunction to prevent further harm, such as the misuse of intellectual property. In certain cases, courts may also order restitution or account for profits to address unfair enrichment." | |
}, | |
{ | |
"question": "How does pre-institution mediation benefit litigants?", | |
"answer": "Pre-institution mediation benefits litigants by offering a cost-effective and time-efficient way to resolve disputes without formal litigation. It preserves business relationships by encouraging amicable settlements and reduces the burden on courts. Additionally, mediated settlements are binding and enforceable, providing certainty and finality to the dispute resolution process. This approach aligns with global best practices in commercial dispute resolution." | |
}, | |
{ | |
"question": "Can commercial courts grant interim reliefs? If so, what types?", | |
"answer": "Yes, commercial courts can grant interim reliefs to preserve the status quo and prevent irreparable harm during litigation. Examples include temporary injunctions to stop a party from breaching a contract, orders to secure assets to ensure the enforcement of judgments, and directions to disclose documents or information. Interim reliefs are critical in safeguarding the interests of the parties while the case is pending." | |
}, | |
{ | |
"question": "What is the importance of the monetary threshold in commercial court cases?", | |
"answer": "The monetary threshold ensures that commercial courts handle disputes of significant financial value, focusing their resources on cases with substantial commercial implications. By setting the threshold at Rs. 3 lakhs, the government has made these courts accessible to a broader range of businesses, including small and medium-sized enterprises (SMEs), without overwhelming the system with low-value disputes." | |
}, | |
{ | |
"question": "What are the limitations of the appeal process in commercial courts?", | |
"answer": "The appeal process in commercial courts is designed to be limited and efficient. Appeals are confined to questions of law or significant procedural errors, and new evidence is generally not admissible. The appellate court aims to resolve appeals within six months, ensuring that the process does not undermine the speed and efficiency of the original judgment. This approach balances the need for judicial review with the goal of expedited dispute resolution." | |
}, | |
{ | |
"question": "How do commercial courts handle cross-border disputes?", | |
"answer": "Commercial courts handle cross-border disputes by applying principles of private international law and relevant treaties. For instance, in disputes involving foreign entities, courts examine jurisdiction clauses in contracts and the applicability of foreign laws. They also facilitate the enforcement of foreign judgments and arbitral awards, provided they meet the criteria under Indian law. This capability makes Indian commercial courts a viable option for resolving international business disputes." | |
}, | |
{ | |
"question": "What role does technology play in modern commercial courts?", | |
"answer": "Technology plays a crucial role in modern commercial courts by enabling electronic filing, virtual hearings, and digital case management systems. Advanced tools like AI-driven legal research platforms and document review systems enhance efficiency and accuracy. These innovations reduce paperwork, minimize delays, and improve access to justice, aligning with global trends in legal technology adoption." | |
}, | |
{ | |
"question": "What training is provided to judges in commercial courts?", | |
"answer": "Judges in commercial courts undergo specialized training to understand complex commercial laws, financial instruments, and industry practices. Workshops and seminars are conducted regularly, focusing on areas like intellectual property, arbitration, and international trade law. This training ensures that judges are equipped to handle intricate disputes with expertise and deliver well-reasoned judgments." | |
}, | |
{ | |
"question": "What are the rules for discovery in commercial courts?", | |
"answer": "Discovery in commercial courts is governed by strict rules to ensure transparency and efficiency. Parties must disclose all relevant documents within specified timelines, and failure to do so can result in adverse inferences or penalties. The process is monitored by the court to prevent misuse or delays. Electronic discovery (e-discovery) is also gaining prominence, allowing parties to produce digital records as evidence." | |
}, | |
{ | |
"question": "What is the role of Alternative Dispute Resolution (ADR) in commercial courts?", | |
"answer": "ADR mechanisms, such as mediation and arbitration, are integral to the commercial court framework. They provide parties with options to resolve disputes amicably and efficiently without resorting to litigation. Courts often encourage ADR to reduce their caseload and expedite resolutions. Mediated settlements and arbitral awards are enforceable under Indian law, providing parties with finality and certainty." | |
} | |
] | |
embedder = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') | |
predefined_qa = load_predefined_qa() | |
questions = [item['question'] for item in predefined_qa] | |
# Function to find the most relevant predefined answer | |
def find_similar_question(query): | |
query_embedding = embedder.encode(query, convert_to_tensor=True) | |
question_embeddings = embedder.encode(questions, convert_to_tensor=True) | |
similarities = util.pytorch_cos_sim(query_embedding, question_embeddings) | |
most_similar_idx = similarities.argmax().item() | |
return predefined_qa[most_similar_idx] | |
# EasyOCR for text extraction | |
def extract_text_from_image(uploaded_file): | |
import tempfile | |
import numpy as np | |
from PIL import Image | |
# Save the uploaded image temporarily | |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_file: | |
temp_file.write(uploaded_file.read()) | |
temp_file_path = temp_file.name | |
# Use EasyOCR to process the image | |
reader = easyocr.Reader(['en']) | |
result = reader.readtext(temp_file_path, detail=0) | |
# Clean up the temporary file | |
os.remove(temp_file_path) | |
return " ".join(result) | |
def extract_text_from_pdf(pdf_path): | |
from PyPDF2 import PdfReader | |
reader = PdfReader(pdf_path) | |
text = "".join([page.extract_text() for page in reader.pages]) | |
return text | |
# Streamlit App UI | |
st.title("Commercial Court Chatbot") | |
# Query Input | |
query = st.text_input("Ask a question about commercial courts") | |
if query: | |
similar_qa = find_similar_question(query) | |
st.write(f"**Q:** {similar_qa['question']}\n\n**A:** {similar_qa['answer']}") | |
uploaded_file = st.file_uploader("Upload an image or PDF", type=["jpg", "jpeg", "png", "pdf"]) | |
if uploaded_file: | |
# Process Image Files | |
if uploaded_file.type in ["image/jpeg", "image/png"]: | |
st.info("Processing image...") | |
text = extract_text_from_image(uploaded_file) | |
# Process PDF Files | |
elif uploaded_file.type == "application/pdf": | |
with open("uploaded_file.pdf", "wb") as f: | |
f.write(uploaded_file.read()) | |
text = extract_text_from_pdf("uploaded_file.pdf") | |
os.remove("uploaded_file.pdf") | |
# Check if the extracted text is related to commercial courts | |
if "commercial court" in text.lower(): | |
st.success("Extracted Text:") | |
st.write(text) | |
# Try to answer based on predefined questions | |
similar_qa = find_similar_question(text) | |
st.write(f"**Q:** {similar_qa['question']}\n\n**A:** {similar_qa['answer']}") | |
else: | |
st.success("Extracted Text:") | |
st.write(text) | |
st.warning("The extracted text does not appear to be related to commercial courts.") |