hugging2021's picture
Update app.py
7eea8b0 verified
Raw
History Blame Contribute Delete
883 Bytes
import os
from dotenv import load_dotenv
load_dotenv()
# Hugging Face API Setup
hf_token = os.getenv("HUGGINGFACEHUB_API_TOKEN")
pinecone_api_key = os.getenv("PINECONE_API_KEY")
tavily_api_key = os.getenv("TAVILY_API_KEY")
import streamlit as st
from core import graph
st.title("💬 Hugging Face Chatbot")
prompt = st.text_input("Enter your question here:")
if prompt:
user_message = st.chat_message("human")
user_message.write(prompt)
with st.spinner("Generating response via Hugging Face..."):
ai_message = st.chat_message("ai")
# Hier wird die Anfrage an deinen Graph übergeben,
# der nun auf Hugging Face Modellen basieren sollte
ai_reply = graph.invoke({"question": prompt})
ai_message.write(ai_reply["generation"])
# Add a footer
st.markdown("---")
st.markdown("Powered by Hugging Face, LangChain and Streamlit")