import os import gradio as gr import torch from transformers import pipeline print(f"Is CUDA available: {torch.cuda.is_available()}") print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}") examples = [['question: Should chest wall irradiation be included after mastectomy and negative node breast cancer? context: This study aims to evaluate local failure patterns in node negative breast cancer patients treated with post-mastectomy radiotherapy including internal mammary chain only. Retrospective analysis of 92 internal or central-breast node-negative tumours with mastectomy and external irradiation of the internal mammary chain at the dose of 50 Gy, from 1994 to 1998. Local recurrence rate was 5 % (five cases). Recurrence sites were the operative scare and chest wall. Factors associated with increased risk of local failure were age context: answer: target: the answer to the question given the context is`. Check out the [BioGPT-Large-PubMedQA model card](https://huggingface.co/microsoft/biogpt-large-pubmedqa) for more info. **Disclaimer:** this demo was made for research purposes only and should not be used for medical purposes. """ def inference(text): output_biogpt = pipe_biogpt(text, max_length=100)[0]["generated_text"] return [ output_biogpt.split(' ')[-1], ] io = gr.Interface( inference, gr.Textbox(lines=3), outputs=[ gr.Textbox(lines=3, label="BioGPT-Large-PubMedQA"), ], title=title, description=description, examples=examples ) io.launch()