codexautomationkey commited on
Commit
beef086
·
verified ·
1 Parent(s): 8c0c023

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +32 -0
  2. requirements.txt +106 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Q&A Chatbot
2
+
3
+ from langchain_openai import OpenAI
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+ import streamlit as st
9
+ import os
10
+
11
+
12
+ # Funtion to load OpenAI model and get responses
13
+
14
+ def get_openai_response(input_text):
15
+ llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"), model_name="gpt-3.5-turbo-instruct", temperature=0.5)
16
+ response = llm.invoke(input=input_text)
17
+ return response
18
+ ## initialize streamlit app
19
+
20
+ st.set_page_config(page_title="Q&A Demo")
21
+ st.header("Langchain Application")
22
+
23
+ input = st.text_input("Input: ", key="input")
24
+
25
+ response = get_openai_response(input)
26
+
27
+ submit=st.button("Generate")
28
+
29
+ ## if ask button is clicked
30
+ if submit:
31
+ st.subheader("The response is")
32
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.9.3
2
+ aiosignal==1.3.1
3
+ altair==5.2.0
4
+ annotated-types==0.6.0
5
+ anyio==4.3.0
6
+ asttokens==2.4.1
7
+ async-timeout==4.0.3
8
+ attrs==23.2.0
9
+ blinker==1.7.0
10
+ cachetools==5.3.3
11
+ certifi==2024.2.2
12
+ charset-normalizer==3.3.2
13
+ click==8.1.7
14
+ colorama==0.4.6
15
+ comm==0.2.2
16
+ dataclasses-json==0.6.4
17
+ debugpy==1.8.1
18
+ decorator==5.1.1
19
+ distro==1.9.0
20
+ exceptiongroup==1.2.0
21
+ executing==2.0.1
22
+ filelock==3.13.1
23
+ frozenlist==1.4.1
24
+ fsspec==2024.3.1
25
+ gitdb==4.0.11
26
+ GitPython==3.1.42
27
+ greenlet==3.0.3
28
+ h11==0.14.0
29
+ httpcore==1.0.4
30
+ httpx==0.27.0
31
+ huggingface-hub==0.21.4
32
+ idna==3.6
33
+ importlib_metadata==7.0.2
34
+ ipykernel==6.29.3
35
+ ipython==8.18.1
36
+ jedi==0.19.1
37
+ Jinja2==3.1.3
38
+ jsonpatch==1.33
39
+ jsonpointer==2.4
40
+ jsonschema==4.21.1
41
+ jsonschema-specifications==2023.12.1
42
+ jupyter_client==8.6.1
43
+ jupyter_core==5.7.2
44
+ langchain==0.1.12
45
+ langchain-community==0.0.29
46
+ langchain-core==0.1.35
47
+ langchain-openai==0.1.1
48
+ langchain-text-splitters==0.0.1
49
+ langsmith==0.1.29
50
+ markdown-it-py==3.0.0
51
+ MarkupSafe==2.1.5
52
+ marshmallow==3.21.1
53
+ matplotlib-inline==0.1.6
54
+ mdurl==0.1.2
55
+ multidict==6.0.5
56
+ mypy-extensions==1.0.0
57
+ nest-asyncio==1.6.0
58
+ numpy==1.26.4
59
+ openai==1.14.3
60
+ orjson==3.9.15
61
+ packaging==23.2
62
+ pandas==2.2.1
63
+ parso==0.8.3
64
+ pillow==10.2.0
65
+ platformdirs==4.2.0
66
+ prompt-toolkit==3.0.43
67
+ protobuf==4.25.3
68
+ psutil==5.9.8
69
+ pure-eval==0.2.2
70
+ pyarrow==15.0.2
71
+ pydantic==2.6.4
72
+ pydantic_core==2.16.3
73
+ pydeck==0.8.1b0
74
+ Pygments==2.17.2
75
+ python-dateutil==2.9.0.post0
76
+ python-dotenv==1.0.1
77
+ pytz==2024.1
78
+ pywin32==306
79
+ PyYAML==6.0.1
80
+ pyzmq==25.1.2
81
+ referencing==0.34.0
82
+ regex==2023.12.25
83
+ requests==2.31.0
84
+ rich==13.7.1
85
+ rpds-py==0.18.0
86
+ six==1.16.0
87
+ smmap==5.0.1
88
+ sniffio==1.3.1
89
+ SQLAlchemy==2.0.28
90
+ stack-data==0.6.3
91
+ streamlit==1.32.2
92
+ tenacity==8.2.3
93
+ tiktoken==0.6.0
94
+ toml==0.10.2
95
+ toolz==0.12.1
96
+ tornado==6.4
97
+ tqdm==4.66.2
98
+ traitlets==5.14.2
99
+ typing-inspect==0.9.0
100
+ typing_extensions==4.10.0
101
+ tzdata==2024.1
102
+ urllib3==2.2.1
103
+ watchdog==4.0.0
104
+ wcwidth==0.2.13
105
+ yarl==1.9.4
106
+ zipp==3.18.1