What I’m trying to do:
I am trying to parse input holding a conversation into a summary model but it throws an error
What I’ve tried and what’s not working:
Hello community, I have a problem with passing an input to a summary model. I fine-tuned a Bart model to some meeting notes, and i am building an anvil app around it. The model returns the correct output when i pass a variable object holding sentences but throws an error when i pass in a dict holding the sentences. It also throws an error when i pass either the dict or senetcnes to the model wrapped in a defined function. The error it throws is "have the wrong format. The should be either of type str
or type list
" This is the link to my kaggle notebook so anyone can access the code
Code Sample:
# this is a formatted code snippet.
#define a function that uses model to summarize conversations
@anvil.server.callable
def summarize(context_text):
question_set = {
'context': context_text
}
results = nlp_pipeline(question_set)
return results['answer']
document = [
"The extractive summarization feature uses natural language processing techniques to locate key sentences in an unstructured text document. "
"These sentences collectively convey the main idea of the document. This feature is provided as an API for developers. "
"They can use it to build intelligent solutions based on the relevant information extracted to support various use cases. "
"In the public preview, extractive summarization supports several languages. It is based on pretrained multilingual transformer models, part of our quest for holistic representations. "
"It draws its strength from transfer learning across monolingual and harness the shared nature of languages to produce models of improved quality and efficiency. "
]
summary_set = {
'context': document
}
summarize(summary_set)
# paste your code between ```
Clone link:
share a copy of your app