Adarsh-aot commited on
Commit
e7795db
·
verified ·
1 Parent(s): fdab579

Upload 3 files

Browse files
Files changed (3) hide show
  1. csv_app.py +63 -0
  2. data.csv.csv +52 -0
  3. requirments.txt +155 -0
csv_app.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import csv
3
+ import chromadb
4
+ from chromadb.utils import embedding_functions
5
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
6
+ from transformers import pipeline
7
+ from langchain.llms import HuggingFacePipeline
8
+
9
+
10
+ chroma_client = chromadb.PersistentClient(path="data_db")
11
+
12
+
13
+ sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-mpnet-base-v2")
14
+
15
+
16
+ collection = chroma_client.get_or_create_collection(name="my_collection", embedding_function=sentence_transformer_ef)
17
+
18
+
19
+ # Streamlit app layout
20
+ st.title("ChromaDB and HuggingFace Pipeline Integration")
21
+
22
+ query = st.text_input("Enter your query:", value="director")
23
+
24
+ if st.button("Search"):
25
+ results = collection.query(
26
+ query_texts=[query],
27
+ n_results=3,
28
+ include=['documents', 'distances', 'metadatas']
29
+ )
30
+ st.write("Query Results:")
31
+ st.write(results['metadatas'])
32
+
33
+ if results['documents']:
34
+ context = results['documents'][0][0]
35
+ st.write("Context:")
36
+ st.write(context)
37
+ tokenizer = AutoTokenizer.from_pretrained("MBZUAI/LaMini-T5-738M")
38
+ model = AutoModelForSeq2SeqLM.from_pretrained("MBZUAI/LaMini-T5-738M")
39
+
40
+ pipe = pipeline(
41
+ "text2text-generation",
42
+ model=model,
43
+ tokenizer=tokenizer,
44
+ max_length=512
45
+ )
46
+
47
+ local_llm = HuggingFacePipeline(pipeline=pipe)
48
+
49
+ l = f"""
50
+ Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
51
+
52
+ {context}
53
+
54
+ Question: {query}
55
+ Helpful Answer:
56
+ """
57
+
58
+ answer = local_llm(l)
59
+ st.write("Answer:")
60
+ st.write(answer)
61
+
62
+
63
+
data.csv.csv ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document,metadata
2
+ "A director provides ongoing liaison with staffed children’s residential services
3
+ to monitor for:
4
+  consistent referral, assessment, planning, treatment and discharge practices
5
+  participation in integrated case management processes as members of a
6
+ child’s team for the duration of the child’s stay
7
+  responsive program development to meet the needs of children receiving
8
+ care and their families
9
+  provision of services under their contracts, and
10
+  adherence to the Standards for Staffed Children’s Residential Services and
11
+ the fulfilment of community care licensing and accreditation requirements.
12
+ RESIDENTIAL SERVICES - STANDARD
13
+ "Note: Monitoring, reviewing and supporting placements in staffed children’s
14
+ residential services is distinct from the supportive role referred to in Caregiver
15
+ Support Service Standard 15: Supportive Practice.
16
+ The director informs relevant care providers within the residential resource
17
+ about a director’s responsibilities and purpose in monitoring the child’s care.
18
+ In consultation with relevant care providers, the director develops a
19
+ monitoring schedule outlining the nature and frequency of contact. Frequency
20
+ of contact is based on the ages, vulnerabilities and number of children in the
21
+ residential resource. Contact occurs in person at a minimum of once every
22
+ three months.
23
+ In collaboration with the child’s worker, during visits to the residential
24
+ resource, the director sees and wherever possible interviews each child in care
25
+ in the residential setting about topics relating to their rights in care. The
26
+ director interviews each relevant care provider separately to discuss his or her
27
+ individual experience with and/or concern about:
28
+  the provision of a safe and nurturing environment that promotes the wellbeing of each child
29
+  carrying out his or her responsibilities in implementing the goals and
30
+ objectives identified in each child’s plan
31
+  honouring each child’s views, culture, identity, spiritual beliefs and
32
+ wishes, and for an Aboriginal child, following the cultural plan
33
+  maintaining family connections as outlined in each child’s plan The director maintains a record of all monitoring visits to the residential
34
+ resource for inclusion on the agency/service contract file, as part of contract
35
+ management and the region’s quality improvement practices.
36
+ The director advises a child’s worker of any concerns relating to a child’s care.
37
+ The director documents a child’s experience in the residential resource and
38
+ provides the child’s worker with information for documentation on the child
39
+ service file.
40
+  reviewing daily records of the care of each child
41
+  adherence of the residential resource to the Standards for Staffed
42
+ Children’s Residential Services, and
43
+  the quality of care in the residential resource.
44
+ ","CSS STANDARD 21: MONITORING OF AND LIAISON WITH STAFFED CHILDREN’S
45
+ RESIDENTIAL SERVICES - POLICY
46
+ "
47
+ " Integrated Case Management User’s Guide
48
+  Standards for Staffed Children’s Residential Services","CSS STANDARD 21: MONITORING OF AND LIAISON WITH STAFFED CHILDREN’S
49
+ RESIDENTIAL SERVICES - ADDITIONAL
50
+ INFORMATION/
51
+ RESOURCES
52
+ "
requirments.txt ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.9.5
2
+ aiosignal==1.3.1
3
+ altair==5.3.0
4
+ annotated-types==0.7.0
5
+ anyio==4.4.0
6
+ asgiref==3.8.1
7
+ async-timeout==4.0.3
8
+ attrs==23.2.0
9
+ backoff==2.2.1
10
+ bcrypt==4.1.3
11
+ blinker==1.8.2
12
+ build==1.2.1
13
+ cachetools==5.3.3
14
+ certifi==2024.6.2
15
+ charset-normalizer==3.3.2
16
+ chroma-hnswlib==0.7.3
17
+ chromadb==0.5.3
18
+ click==8.1.7
19
+ colorama==0.4.6
20
+ coloredlogs==15.0.1
21
+ dataclasses-json==0.6.7
22
+ Deprecated==1.2.14
23
+ dnspython==2.6.1
24
+ email_validator==2.2.0
25
+ exceptiongroup==1.2.1
26
+ fastapi==0.111.0
27
+ fastapi-cli==0.0.4
28
+ filelock==3.15.4
29
+ flatbuffers==24.3.25
30
+ frozenlist==1.4.1
31
+ fsspec==2024.6.0
32
+ gitdb==4.0.11
33
+ GitPython==3.1.43
34
+ google-auth==2.30.0
35
+ googleapis-common-protos==1.63.2
36
+ greenlet==3.0.3
37
+ grpcio==1.64.1
38
+ h11==0.14.0
39
+ httpcore==1.0.5
40
+ httptools==0.6.1
41
+ httpx==0.27.0
42
+ huggingface-hub==0.23.4
43
+ humanfriendly==10.0
44
+ idna==3.7
45
+ importlib_metadata==7.1.0
46
+ importlib_resources==6.4.0
47
+ InstructorEmbedding==1.0.1
48
+ intel-openmp==2021.4.0
49
+ Jinja2==3.1.4
50
+ joblib==1.4.2
51
+ jsonpatch==1.33
52
+ jsonpointer==3.0.0
53
+ jsonschema==4.22.0
54
+ jsonschema-specifications==2023.12.1
55
+ kubernetes==30.1.0
56
+ langchain==0.2.5
57
+ langchain-community==0.2.5
58
+ langchain-core==0.2.9
59
+ langchain-text-splitters==0.2.1
60
+ langsmith==0.1.82
61
+ markdown-it-py==3.0.0
62
+ MarkupSafe==2.1.5
63
+ marshmallow==3.21.3
64
+ mdurl==0.1.2
65
+ mkl==2021.4.0
66
+ mmh3==4.1.0
67
+ monotonic==1.6
68
+ mpmath==1.3.0
69
+ multidict==6.0.5
70
+ mypy-extensions==1.0.0
71
+ networkx==3.3
72
+ nltk==3.8.1
73
+ numpy==1.26.4
74
+ oauthlib==3.2.2
75
+ onnxruntime==1.18.0
76
+ opentelemetry-api==1.25.0
77
+ opentelemetry-exporter-otlp-proto-common==1.25.0
78
+ opentelemetry-exporter-otlp-proto-grpc==1.25.0
79
+ opentelemetry-instrumentation==0.46b0
80
+ opentelemetry-instrumentation-asgi==0.46b0
81
+ opentelemetry-instrumentation-fastapi==0.46b0
82
+ opentelemetry-proto==1.25.0
83
+ opentelemetry-sdk==1.25.0
84
+ opentelemetry-semantic-conventions==0.46b0
85
+ opentelemetry-util-http==0.46b0
86
+ orjson==3.10.5
87
+ overrides==7.7.0
88
+ packaging==24.1
89
+ pandas==2.2.2
90
+ pillow==10.3.0
91
+ posthog==3.5.0
92
+ protobuf==4.25.3
93
+ pyarrow==16.1.0
94
+ pyasn1==0.6.0
95
+ pyasn1_modules==0.4.0
96
+ pydantic==2.7.4
97
+ pydantic_core==2.18.4
98
+ pydeck==0.9.1
99
+ Pygments==2.18.0
100
+ pypdf==4.2.0
101
+ PyPika==0.48.9
102
+ pyproject_hooks==1.1.0
103
+ pyreadline3==3.4.1
104
+ python-dateutil==2.9.0.post0
105
+ python-dotenv==1.0.1
106
+ python-multipart==0.0.9
107
+ pytz==2024.1
108
+ PyYAML==6.0.1
109
+ referencing==0.35.1
110
+ regex==2024.5.15
111
+ requests==2.32.3
112
+ requests-oauthlib==2.0.0
113
+ rich==13.7.1
114
+ rpds-py==0.18.1
115
+ rsa==4.9
116
+ safetensors==0.4.3
117
+ scikit-learn==1.5.0
118
+ scipy==1.14.0
119
+ sentence-transformers==2.2.2
120
+ sentencepiece==0.2.0
121
+ shellingham==1.5.4
122
+ six==1.16.0
123
+ smmap==5.0.1
124
+ sniffio==1.3.1
125
+ SQLAlchemy==2.0.31
126
+ starlette==0.37.2
127
+ streamlit==1.36.0
128
+ sympy==1.12.1
129
+ tbb==2021.13.0
130
+ tenacity==8.4.2
131
+ threadpoolctl==3.5.0
132
+ tiktoken==0.7.0
133
+ tokenizers==0.19.1
134
+ toml==0.10.2
135
+ tomli==2.0.1
136
+ toolz==0.12.1
137
+ torch==2.3.1
138
+ torchvision==0.18.1
139
+ tornado==6.4.1
140
+ tqdm==4.66.4
141
+ transformers==4.41.2
142
+ typer==0.12.3
143
+ typing-inspect==0.9.0
144
+ typing_extensions==4.12.2
145
+ tzdata==2024.1
146
+ ujson==5.10.0
147
+ urllib3==2.2.2
148
+ uvicorn==0.30.1
149
+ watchdog==4.0.1
150
+ watchfiles==0.22.0
151
+ websocket-client==1.8.0
152
+ websockets==12.0
153
+ wrapt==1.16.0
154
+ yarl==1.9.4
155
+ zipp==3.19.2