sharma-kanishka commited on
Commit
9d56548
·
1 Parent(s): f9b969e

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +34 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import AI21
2
+ from langchain.prompts import PromptTemplate
3
+ from langchain.chains import LLMChain
4
+ import streamlit as st
5
+
6
+ import os
7
+ import dotenv
8
+
9
+ dotenv.load_dotenv()
10
+
11
+ def get_resp(type,color):
12
+ llm=AI21(ai21_api_key=os.environ['AI21_API_KEY'],temperature=0.3)
13
+
14
+ prompt=PromptTemplate(input_variables=['type','color'],
15
+ template="suggest some pet names for a {type} of {color} color")
16
+
17
+ chain=LLMChain(llm=llm,prompt=prompt)
18
+
19
+ response=chain.run(type=type,color=color)
20
+ return response
21
+
22
+
23
+ st.set_page_config(page_title="PetName-Generator")
24
+
25
+ st.header("P-N-G")
26
+ col1,col2=st.columns([1,1])
27
+ with col1:
28
+ type=st.text_input("Enter type of animal:")
29
+ with col2:
30
+ color=st.text_input("Enter color of animal:")
31
+
32
+ submit=st.button("generate")
33
+ if submit:
34
+ st.write(get_resp(type,color))
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ langchain
2
+ python-dotenv
3
+ streamlit
4
+ ipykernel