Spaces:
Runtime error
Runtime error
themanas021
commited on
Commit
•
e16f2b0
1
Parent(s):
56faf0e
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from langchain import PromptTemplate
|
3 |
+
from langchain.chains import LLMChain
|
4 |
+
|
5 |
+
# Import your model and template
|
6 |
+
llm_hf = HuggingFaceHub(
|
7 |
+
repo_id="tiiuae/falcon-7b-instruct",
|
8 |
+
model_kwargs={"temperature": 0.3}
|
9 |
+
)
|
10 |
+
|
11 |
+
restaurant_template = """
|
12 |
+
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...
|
13 |
+
"""
|
14 |
+
|
15 |
+
# Define the Streamlit app
|
16 |
+
def main():
|
17 |
+
st.title("Indian Legal Consultation")
|
18 |
+
|
19 |
+
# Input for the user's issue
|
20 |
+
description = st.text_area("Please describe your issue:")
|
21 |
+
|
22 |
+
if st.button("Get Legal Advice"):
|
23 |
+
if description:
|
24 |
+
# Create a PromptTemplate
|
25 |
+
prompt = PromptTemplate(
|
26 |
+
input_variables=["issue"],
|
27 |
+
template=restaurant_template,
|
28 |
+
)
|
29 |
+
|
30 |
+
# Create an LLMChain
|
31 |
+
chain = LLMChain(llm=llm_hf, prompt=prompt)
|
32 |
+
|
33 |
+
# Generate a response
|
34 |
+
response = chain.run(description)
|
35 |
+
|
36 |
+
# Display the response
|
37 |
+
st.subheader("Legal Advice:")
|
38 |
+
st.write(response)
|
39 |
+
else:
|
40 |
+
st.warning("Please provide a description of your issue.")
|
41 |
+
|
42 |
+
if __name__ == "__main__":
|
43 |
+
main()
|