Spaces:
Running
Running
import gradio as gr | |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer | |
model = AutoModelForSeq2SeqLM.from_pretrained("Mbilal755/Radiology_Bart") | |
tokenizer = AutoTokenizer.from_pretrained("Mbilal755/Radiology_Bart") | |
def summarize(input): | |
inputs = tokenizer(input, return_tensors="pt") | |
output = model.generate(inputs["input_ids"]) | |
summary = tokenizer.decode(output[0], skip_special_tokens=True) | |
return summary | |
iface = gr.Interface(fn=summarize, inputs="text", outputs="text") | |
if __name__ == "__main__": | |
iface.launch(share=True) |