Spaces:
Sleeping
Sleeping
File size: 438 Bytes
35bda59 | 1 2 3 4 5 6 7 8 9 10 11 | from transformers.pipelines import pipeline
import streamlit as st
def get_answer(query, context):
try:
qa_model = pipeline("document-question-answering", model="distilbert-base-cased-distilled-squad")
result = qa_model(question=query, context=context)
return result["answer"]
except Exception as e:
st.error(f"Error generating answer: {e}")
return "Sorry, I could not process your query." |