Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +25 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Q&A Chatbot
|
2 |
+
from langchain.llms import OpenAI
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
import os
|
5 |
+
import streamlit as st
|
6 |
+
load_dotenv()
|
7 |
+
|
8 |
+
def get_openai_response(question):
|
9 |
+
llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"),model_name='gpt-3.5-turbo-instruct',temperature=0.5)
|
10 |
+
response= llm(question)
|
11 |
+
return response
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
# streamlit code
|
16 |
+
st.set_page_config(page_title='Q&A Demo')
|
17 |
+
st.header("Langchain Application")
|
18 |
+
|
19 |
+
input= st.text_input("input :",key='input')
|
20 |
+
response = get_openai_response(input)
|
21 |
+
|
22 |
+
submit = st.button('Ask the Question')
|
23 |
+
if submit:
|
24 |
+
st.subheader("The Response is")
|
25 |
+
st.write(response)
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
langchain
|
3 |
+
huggingface_hug
|
4 |
+
python-dotenv
|
5 |
+
streamlit
|