sudhir2016 commited on
Commit
4c1b6db
1 Parent(s): a1f8773

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -1,12 +1,13 @@
1
- import gradio as gradio
2
- from langchain import PromptTemplate, HuggingFaceHub, LLMChain
3
- import os
4
- llm=HuggingFaceHub(repo_id="google/flan-t5-xxl")
5
- template = 'question:{question}'
6
- prompt = PromptTemplate(template=template, input_variables=["question"])
7
- chain = LLMChain(llm=llm, prompt=prompt)
 
8
  def answer(question):
9
- out=chain.run(question)
10
  return out
11
- demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples= [['What is the capital of India ?']])
12
  demo.launch()
 
1
+ import gradio as gr
2
+ from langchain_huggingface import HuggingFaceEndpoint
3
+ llm = HuggingFaceEndpoint(
4
+ repo_id="meta-llama/Meta-Llama-3-8B-Instruct",
5
+ task="text-generation",
6
+ max_new_tokens=100,
7
+ do_sample=False,
8
+ )
9
  def answer(question):
10
+ out=llm.invoke(question)
11
  return out
12
+ demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples=[['What is the capital of India ?']])
13
  demo.launch()