Spaces:
Sleeping
Sleeping
Commit
·
6ddeb4a
0
Parent(s):
Initial and final commit
Browse files- app.py +20 -0
- data/user_info.json +0 -0
- requirements.txt +5 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from langchain.llms import HuggingFaceHub
|
3 |
+
|
4 |
+
st.set_page_config(page_title="Educational Chatbot")
|
5 |
+
|
6 |
+
st.title("🎓 Educational Chatbot")
|
7 |
+
|
8 |
+
user_input = st.text_input("Ask me anything:")
|
9 |
+
|
10 |
+
if "history" not in st.session_state:
|
11 |
+
st.session_state.history = []
|
12 |
+
|
13 |
+
if user_input:
|
14 |
+
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature": 0.5, "max_new_tokens": 100})
|
15 |
+
response = llm(user_input)
|
16 |
+
st.session_state.history.append(("You", user_input))
|
17 |
+
st.session_state.history.append(("Bot", response))
|
18 |
+
|
19 |
+
for sender, msg in reversed(st.session_state.history):
|
20 |
+
st.markdown(f"**{sender}:** {msg}")
|
data/user_info.json
ADDED
File without changes
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
langchain
|
3 |
+
langchain-community
|
4 |
+
huggingface_hub
|
5 |
+
python-dotenv
|