vmalapaka commited on
Commit
c51080a
·
verified ·
1 Parent(s): b73823d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py CHANGED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ from langchain.llms import HuggingFaceEndpoint
4
+
5
+ #Taking question as input from user
6
+ def load_answer(question):
7
+ llm=HuggingFaceEndpoint(
8
+ repo_id="mistralai/Mistral-7B-Instruct-v0.2",temperature=0)
9
+ answer=llm(question)
10
+ return answer
11
+
12
+ st.set_page_config(page_title="Question and Answers", page_icon= ":robot:")
13
+ st.header("Question and Answers")
14
+
15
+ def get_text():
16
+ input_text = st.text_input("Type your question here: " , keys="input")
17
+ return input_text
18
+
19
+
20
+ user_input = get_text()
21
+ response = load_answer(user_input)
22
+
23
+ submit = st.button("Generate")
24
+
25
+ if submit:
26
+ st.subHeader("Answer:")
27
+ st.write(response)