Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
from langchain.llms import HuggingFaceHub
|
4 |
+
|
5 |
+
def load_answers(question):
|
6 |
+
llm = HuggingFaceHub(repo_id="google/flan-t5-large")
|
7 |
+
answer = llm(question)
|
8 |
+
return answer
|
9 |
+
|
10 |
+
st.set_page_config(page_title="LangChain LLM LAB", page_icon="🔗", layout="wide")
|
11 |
+
st.header("LangChain LLM LAB")
|
12 |
+
|
13 |
+
def get_text():
|
14 |
+
input_text = st.text_input("Enter your question here...",key="question")
|
15 |
+
return input_text
|
16 |
+
|
17 |
+
user_input = get_text()
|
18 |
+
|
19 |
+
response = load_answers(user_input)
|
20 |
+
|
21 |
+
submit = st.button("Generate Answer")
|
22 |
+
|
23 |
+
if submit:
|
24 |
+
st.subheader("Answer:")
|
25 |
+
st.write(response)
|
26 |
+
|
27 |
+
|