first commit
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain.llms import OpenAI
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
|
4 |
+
load_dotenv()
|
5 |
+
|
6 |
+
import streamlit as st
|
7 |
+
import os
|
8 |
+
|
9 |
+
|
10 |
+
#for Openai model load and get response
|
11 |
+
|
12 |
+
def get_openai_response(question):
|
13 |
+
llm = OpenAI(openai_api_key =os.getenv('OPEN_API_KEY'),
|
14 |
+
model_name = "gpt-3.5-turbo-instruct",temperature = 0.6)
|
15 |
+
response = llm(question)
|
16 |
+
return response
|
17 |
+
#streamlit app
|
18 |
+
|
19 |
+
st.set_page_config(page_title= "Demo App")
|
20 |
+
st.header('Yash app')
|
21 |
+
|
22 |
+
input = st.text_input("Input: ", key="input")
|
23 |
+
response = get_openai_response(input)
|
24 |
+
|
25 |
+
|
26 |
+
submit = st.button("Ask Question")
|
27 |
+
|
28 |
+
|
29 |
+
if submit:
|
30 |
+
st.subheader("Response from GPT")
|
31 |
+
st.write(response)
|