# -*- coding: utf-8 -*- """ Created on Wed Mar 1 13:48:19 2023 @author: Alexandru Vasile """ import os import gradio as gr import torch from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM 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"), ], title=title, description=description, examples=examples ) io.launch()