import gradio as gr from keyword_extractor import KeywordExtractor extractor = KeywordExtractor() def extract_keywords(text): if not text.strip(): return "Please enter a valid abstract." keywords = extractor.extract(text) return ", ".join(keywords) demo = gr.Interface( fn=extract_keywords, inputs=gr.Textbox(lines=10, label="Enter Abstract"), outputs=gr.Textbox(label="Extracted Keywords"), title="Scientific Keyword Extractor", description="Extract domain-specific keywords from scientific abstracts using BioBERT + KeyBERT + UMAP/HDBSCAN.", examples=[ ["This study investigates the role of gene expression in patients with chronic kidney disease using machine learning techniques..."], ] ) if __name__ == "__main__": demo.launch()