from transformers import pipeline import gradio as gr import wikipediaapi import nltk nltk.download('punkt') def get_wiki_summary(search): wiki_wiki = wikipediaapi.Wikipedia('en') page = wiki_wiki.page(search) isExist = page.exists() if not isExist: return isExist, "Not found", "Not found", "Not found", "Not found" url = page.fullurl tittle = page.title summary = page.summary[0:60] text = page.text return isExist, url, tittle, summary, text wiki_summary = gr.Interface( get_wiki_summary, gr.Text(label="Search Wikipedia"), [ gr.Text(label="Page exists?"), gr.Text(label="URL"), gr.Text(label="Title"), gr.Text(label="Summary"), gr.Text(label="Text") ] ) wiki_summary.launch()