File size: 1,337 Bytes
e16f2b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import streamlit as st
from langchain import PromptTemplate
from langchain.chains import LLMChain

# Import your model and template
llm_hf = HuggingFaceHub(
    repo_id="tiiuae/falcon-7b-instruct",
    model_kwargs={"temperature": 0.3}
)

restaurant_template = """
I want you to become an indian lawyer and enlist me the acts and rights with a one liner description, for every issue i'll raise, you've to only give me relevant acts and rights covering from that issue...
"""

# Define the Streamlit app
def main():
    st.title("Indian Legal Consultation")
    
    # Input for the user's issue
    description = st.text_area("Please describe your issue:")

    if st.button("Get Legal Advice"):
        if description:
            # Create a PromptTemplate
            prompt = PromptTemplate(
                input_variables=["issue"],
                template=restaurant_template,
            )
            
            # Create an LLMChain
            chain = LLMChain(llm=llm_hf, prompt=prompt)
            
            # Generate a response
            response = chain.run(description)
            
            # Display the response
            st.subheader("Legal Advice:")
            st.write(response)
        else:
            st.warning("Please provide a description of your issue.")

if __name__ == "__main__":
    main()