quocdat25 commited on
Commit
6222bec
1 Parent(s): 3f0bce7

Upload folder using huggingface_hub

Browse files
.ipynb_checkpoints/test_gradio-checkpoint.py CHANGED
@@ -17,8 +17,8 @@ llm = HuggingFaceEndpoint(
17
 
18
 
19
  template = """You're a good chatbot. Answer this request: {question}
20
- Answer: Lprompt = PromptTemplate.from_template(template=template)
21
- et's think step by step."""
22
  llm_chain = LLMChain(llm=llm, prompt=prompt)
23
 
24
 
@@ -29,7 +29,7 @@ def predict(message, history):
29
  # history_langchain_format.append(AIMessage(content=ai))
30
  # history_langchain_format.append(HumanMessage(content=message))
31
  # gpt_response = llm(history_langchain_format)
32
- response = llm_chain.invoke(message)['text']
33
  return response
34
 
35
  gr.ChatInterface(predict).launch()
 
17
 
18
 
19
  template = """You're a good chatbot. Answer this request: {question}
20
+ Answer: Let's think step by step."""
21
+ prompt = PromptTemplate.from_template(template=template)
22
  llm_chain = LLMChain(llm=llm, prompt=prompt)
23
 
24
 
 
29
  # history_langchain_format.append(AIMessage(content=ai))
30
  # history_langchain_format.append(HumanMessage(content=message))
31
  # gpt_response = llm(history_langchain_format)
32
+ response = llm_chain.invoke(message)
33
  return response
34
 
35
  gr.ChatInterface(predict).launch()
test_gradio.py CHANGED
@@ -17,8 +17,8 @@ llm = HuggingFaceEndpoint(
17
 
18
 
19
  template = """You're a good chatbot. Answer this request: {question}
20
- Answer: Lprompt = PromptTemplate.from_template(template=template)
21
- et's think step by step."""
22
  llm_chain = LLMChain(llm=llm, prompt=prompt)
23
 
24
 
@@ -29,7 +29,7 @@ def predict(message, history):
29
  # history_langchain_format.append(AIMessage(content=ai))
30
  # history_langchain_format.append(HumanMessage(content=message))
31
  # gpt_response = llm(history_langchain_format)
32
- response = llm_chain.invoke(message)['text']
33
  return response
34
 
35
  gr.ChatInterface(predict).launch()
 
17
 
18
 
19
  template = """You're a good chatbot. Answer this request: {question}
20
+ Answer: Let's think step by step."""
21
+ prompt = PromptTemplate.from_template(template=template)
22
  llm_chain = LLMChain(llm=llm, prompt=prompt)
23
 
24
 
 
29
  # history_langchain_format.append(AIMessage(content=ai))
30
  # history_langchain_format.append(HumanMessage(content=message))
31
  # gpt_response = llm(history_langchain_format)
32
+ response = llm_chain.invoke(message)
33
  return response
34
 
35
  gr.ChatInterface(predict).launch()