Spaces:
Runtime error
Runtime error
File size: 1,027 Bytes
715b816 29b1ee9 715b816 29b1ee9 715b816 29b1ee9 715b816 |
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 31 32 33 34 35 36 |
# Import necessary libraries
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 *
import pathlib
# 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
iface = 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 of the interface
description="Enter your requirements & get valuable insight from Guru."
)
# Start the Gradio app
iface.launch(inline=False)
|