deepakbatham572 commited on
Commit
797409a
·
verified ·
1 Parent(s): 89e54a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py CHANGED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ from langchain.llms import HuggingFaceHub
4
+
5
+ st.set_page_config(page_tile = "Langchain Chatbot" , page_icon = ":robot:")
6
+ st.setheader("Langchain Demo")
7
+
8
+
9
+ def get_text():
10
+ input_text = st.text_input("input: " , key= "input")
11
+ return input_text
12
+
13
+ def load_answer(question):
14
+ llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-instruct-v0.2")
15
+ answer = llm.invoke(question)
16
+ return answer
17
+
18
+
19
+ user =get_text()
20
+ response=load_answer(user)
21
+
22
+ submit = st.button('Generate')
23
+
24
+ if submit:
25
+
26
+ st.subheader("Answered")
27
+
28
+ st.write(response)
29
+