Spaces:
Runtime error
Runtime error
File size: 1,024 Bytes
715b816 07d4213 29b1ee9 715b816 11a83e8 715b816 11a83e8 29b1ee9 715b816 11a83e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# Import necessary libraries
import blurr
import gradio as gr
from pathlib import Path
from fastai.text.all import *
from blurr.text.data.all import *
from blurr.text.modeling.all import *
# Load the learner
inf_learn = load_learner(fname=Path("laptop_summarizer_1.pkl"))
# Define a function to generate summaries using your model
def generate_summary(input_text):
prediction = inf_learn.blurr_generate(input_text)
generated_text = prediction[0]['generated_texts']
return generated_text
# Create an interface for the model
interface = gr.Interface(
fn=generate_summary, # The function to generate summaries
inputs=gr.inputs.Textbox(), # Input field for text
outputs=gr.outputs.Textbox(), # Output field for generated text
live=True, # Whether to update results in real-time
title="Laptop Guru", # Title of the interface
description="Enter your requirements & get valuable insight from Guru." # Description of the interface
)
# Start the Gradio app
interface.launch(inline=True)
|