I'm working on a recommender system that uses gradio interface for text input. When asking for bag of words suggestions, bow_input is seen as "string" => fine
When asking for Bert suggestions, bert input is seen as none. Here are the logs :
text input None
WARNING:root:Received None as text input
Here's the code of Gradio interface :
def setup_gradio_interface():
with gr.Blocks() as recommander:
with gr.Tab("Bag of words suggestions"):
bow_input = gr.Textbox(label="Tell me what you want...")
bow_output = gr.Textbox(label="I tell you what to watch!")
bow_button = gr.Button("Generate your top 5 BOW recos.")
bow_button.click(process_BOW, inputs=bow_input, outputs = bow_output)
pass
with gr.Tab("BERT suggestions"):
bert_input = gr.Textbox(label="Tell me what you want...")
bert_output = gr.Textbox(label="I tell you what to watch!")
bert_button = gr.Button("Generate your top 5 BERT recos.")
bert_button.click(process_BERT, inputs=bert_input, outputs=bert_output)
return recommander
here is the beginning of my pipeline to create embeddings and send request to Flask:
def process_BERT (bertmodel, bert_input):
print("text input",bert_input)
embedding_BERT = create_bert_embeddings(bertmodel,bert_input)
that calls
def create_bert_embeddings(tokenizer, text_input):
if text_input is None:
logging.warning("Received None as text input")
return None
print("text_input type:", type(text_input))
text_input=str(text_input)
input=clean_text(text_input)
Any idea why is the input "None"?
I tried to debug with logging, share common interface between BOW and Bert input, and try on an isolate app for Bert. Still the same problem.