Spaces:
Paused
Paused
File size: 688 Bytes
797409a dce9b06 797409a ea4c3d6 c7c328b ea4c3d6 02b3667 125add4 797409a 1a9d997 797409a 1a9d997 797409a c6709fc 797409a c6709fc 797409a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import streamlit as st
from langchain.llms import HuggingFaceEndpoint
def load_answer(question):
llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-instruct-v0.2" )
answer = llm.invoke(question)
return answer
st.set_page_config(page_title = "Langchain Chatbot" , page_icon = ":robot:")
st.header("Langchain Demo")
def get_text():
input_text = st.text_input("you: " , key="input")
return input_text
user_input=get_text()
submit = st.button('Generate')
if submit:
if not user_input.strip():
st.write("Please enter a question. ")
else:
response= load_answer(user_input)
st.subheader("Answer: ")
st.write(response)
|