Spaces:
Sleeping
Sleeping
| 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.") | |
| 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() | |