File size: 1,305 Bytes
0de700e
7851606
 
0de700e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7851606
 
0de700e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import streamlit as st
from transformers import pipeline

def main():
    st.set_page_config(page_title="Gradio QA Demo", page_icon="πŸ€–", layout="wide")
    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)}")

if __name__ == "__main__":
    main()