vivekraina commited on
Commit
a8c2c65
1 Parent(s): 1d123b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ from langchain import HuggingFaceHub, LLMChain
3
+ from langchain.prompts import PromptTemplate
4
+
5
+ load_dotenv()
6
+
7
+ # hub_llm = HuggingFaceHub(repo_id="mrm8488/t5-base-finetuned-wikiSQL")
8
+
9
+ # prompt = PromptTemplate(
10
+ # input_variables=["question"],
11
+ # template="Translate English to SQL: {question}"
12
+ # )
13
+
14
+ # hub_chain = LLMChain(prompt=prompt, llm=hub_llm, verbose=True)
15
+ # print(hub_chain.run("What is the average age of the respondents using a mobile device?"))
16
+
17
+
18
+ # second example below:
19
+ hub_llm = HuggingFaceHub(
20
+ repo_id='kaist-ai/selfee-7b-delta',
21
+ model_kwargs={'temperature': 0.5, 'max_length': 100}
22
+ )
23
+
24
+ prompt = PromptTemplate(
25
+ input_variables=["profession"],
26
+ template="You are about to start your carrer as {profession}, how do you feel?"
27
+ )
28
+
29
+ hub_chain = LLMChain(prompt=prompt, llm=hub_llm, verbose=True)
30
+ print(hub_chain.run("customer service agent"))
31
+ print(hub_chain.run("politician"))
32
+ print(hub_chain.run("Fintech CEO"))
33
+ print(hub_chain.run("insurance agent"))