import gradio as gr from fastai.text.all import * from blurr.text.modeling.all import load # Load the exported model learn = load_learner('article_highlights.pkl') def generate_summary(article_text): # Perform inference using the loaded model summary = learn.blurr_generate_summary(article_text) return summary iface = gr.Interface( fn=generate_summary, inputs="text", outputs="text", title="Article Summarizer", description="Enter an article and get a summary.", examples=[ ["Text of an article goes here..."] ] ) # Update: Use load from the evaluate library squad_metric = load("squad") iface.launch()