Spaces:
Runtime error
Runtime error
Download app.py from atef123/Resume-ChatBot: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/spaces/atef123/Resume-ChatBot/resolve/main/app.py
- Command line
-
hf download hf://spaces/atef123/Resume-ChatBot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/atef123/Resume-ChatBot/resolve/main/app.py
1.44 kB
| import os | |
| os.system("pip install --upgrade pip") | |
| os.system("pip install -r requirements.txt") | |
| # import langchain dependencies | |
| # from langchain.document_loaders import PyPDFLoader | |
| # from langchain.indexes import VectorstoreIndexCreator | |
| # from langchain.chains import RetrievalQA | |
| # from langchain.embeddings import HuggingFaceBgeEmbeddings | |
| # from langchain.text_splitter import RecursiveCharacterTextSplitter | |
| # Bring in streamlit for UI dev | |
| import streamlit as st | |
| from chatbot import Bot | |
| # Bring in watsonx interface | |
| # from watsonxlangchain import LangChainInterface | |
| # # Create columns with appropriate widths | |
| # col1, col2, col3 = st.columns([1, 3, 1]) | |
| # # Display the image in the center column | |
| # with col2: | |
| # st.image("GP1_Dark_Blue_2.png", caption="A picture of me", width=200) | |
| st.title("Welcome to Mohamed Atef's Personal Assistant ! 🤖👋") | |
| bot = Bot() | |
| if "messages" not in st.session_state: | |
| st.session_state["messages"] = [] | |
| for message in st.session_state["messages"]: | |
| st.chat_message(message["role"]).markdown(message["content"]) | |
| prompt = st.chat_input("Ask me anything!") | |
| if prompt: | |
| st.chat_message("User").markdown(prompt) | |
| st.session_state["messages"].append({"role": "user", "content": prompt}) | |
| answer = bot.answer_question(prompt) | |
| st.chat_message("assistant").write_stream(bot.stream_data(answer)) | |
| st.session_state["messages"].append({"role": "assistant", "content": answer}) | |