axionx-demo / app.py
deepsodha's picture
Update app.py
b8af99b verified
raw
history blame
1.26 kB
import streamlit as st
from transformers import pipeline
def main():
st.title("πŸ€– AxionX Digital β€” Question Answering Demo")
st.markdown("Type a paragraph in **Context**, then ask a **Question** about it.")
@st.cache_resource
def load_model():
return pipeline("question-answering", model="distilbert-base-cased-distilled-squad")
qa = load_model()
context = st.text_area("Context", value=(
"AxionX Digital builds model-training tools for AI developers. "
"We fine-tune open-source LLMs for customer support, finance, and legal use cases. "
"We also provide evaluation dashboards and fast private deployments."
), height=200)
question = st.text_input("Question", value="What does AxionX Digital build?")
if st.button("πŸ” Get Answer"):
if not context.strip() or not question.strip():
st.warning("Please enter both context and question.")
else:
result = qa(question=question, context=context)
st.subheader("πŸ“„ Answer")
st.write(f"**Answer:** {result['answer']}")
st.write(f"**Confidence Score:** {round(result['score'], 3)}")
# βœ… Make sure it runs standalone too
if __name__ == "__main__":
main()