<jupyter_start><jupyter_text>**Deploying The Model as a Web App using Gradio**<jupyter_code>import gradio as gr
# creating the function
def func(context, question):
  result = nlp(question = question, context=context)
  return result['answer']
example_1 = "(1) My name is <NAME>, I am a data scientist and machine learning engineer"
qst_1 =  "what is christian's profession?"

example_2 = "(2) Natural Language Processing (NLP) allows machines to break down and interpret human language. It's at the core of tools we use every day – from translation software, chatbots, spam filters, and search engines, to grammar correction software, voice assistants, and social media monitoring tools."
qst_2 =  "What is NLP used for?"
# creating the interface
app = gr.Interface(fn=func, inputs = ['textbox', 'text'], outputs = 'textbox', 
                   title = 'Question Answering bot', theme = 'dark-grass',
                   description = 'Input context and question, then get answers!',
                   examples = [[example_1, qst_1],
                               [example_2, qst_2]]
                   )
# launching the app
app.launch(share=True, inline=False)<jupyter_output>Colab notebook detected. To show errors in colab notebook, set `debug=True` in `launch()`
Running on public URL: https://52616.gradio.app

This share link expires in 72 hours. For free permanent hosting, check out Spaces (https://huggingface.co/spaces)
{'fraction_non_alphanumeric': 0.09567039106145252, 'fraction_numerical': 0.011871508379888268, 'mean_word_length': 3.6225806451612903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '633545', 'license': 'MIT', 'n_tokens_mistral': 411, 'n_tokens_neox': 386, 'n_words': 162, 'path': 'NLP_Question_Answer_model_deployment_with_Gradio.ipynb', 'repo_name': 'christian-freshness/NLP-Web-App-deployment-using-Gradio', 'size': '1442'}