hsr-builds-llm / app.py
aika42's picture
Update app.py
2ab22e1 verified
import streamlit as st
from rag_engine import RAGEngine
import streamlit.components.v1 as components
st.title("๐Ÿ”ฎ Honkai Star Rail - Build Advisor (DeepSeek RAG)")
st.markdown("Ask me how to build any character, and I will tell you the **optimal setup**!")
# Initialize RAG
rag = RAGEngine()
# Embed Hugging Face interface using components
components.iframe("https://aika42-hsr-builds-llm.hf.space/?embed=true", height=600)
# User Input
query = st.text_input("Enter your build question (e.g., How to build Jingliu?)")
if query:
st.write("Generating answer...")
with st.spinner("Consulting the Stellaron Hunters..."):
stream = rag.stream_answer(query)
response = st.empty() # Create a container for streamed content
text = ""
# Stream and display each chunk as it comes in
for chunk in stream:
text += chunk # Add the chunk to the accumulated text
response.markdown(text) # Update the Streamlit app with the current text