Spaces:
Runtime error
Runtime error
File size: 581 Bytes
a63d286 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import streamlit as st
from transformers import pipeline
st.title("Question Answering with Hugging Face")
model_name = "distilbert-base-cased-distilled-squad"
nlp = pipeline("question-answering", model=model_name)
context = st.text_area("Enter the context here:")
if not context:
st.warning("Please enter a context.")
else:
question = st.text_input("Enter your question here:")
if not question:
st.warning("Please enter a question.")
else:
answer = nlp({"question": question, "context": context})
st.write(f"Answer: {answer['answer']}")
|