rohitdiwane commited on
Commit
e2cd0b0
·
verified ·
1 Parent(s): bef293f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def generate_trip_plan(question):
2
+ hf_api_key = hf_api_key
3
+ repo_id = 'tiiuae/falcon-7b'
4
+ llm = HuggingFaceHub(huggingfacehub_api_token=hf_api_key,
5
+ repo_id=repo_id,
6
+ model_kwargs={"temperature": 0.7, "max_new_tokens": 500})
7
+ template="""Question: {question}
8
+ Answer: Let's give a detailed answer."""
9
+
10
+ prompt = PromptTemplate(template=template, input_variables=['question'])
11
+ chain = LLMChain(prompt=prompt, llm=llm)
12
+ out = chain.run(question)
13
+ return out
14
+
15
+ input_text = gr.Textbox(label="Enter your question")
16
+ generate_button = gr.Button("Generate")
17
+
18
+ iface = gr.Interface(fn=generate_trip_plan, inputs=input_text, outputs=gr.Textbox())
19
+ iface.launch()