laptop_guru / app.py
tdnathmlenthusiast's picture
removed socket_options argument
11a83e8 verified
raw
history blame
No virus
1.02 kB
# 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)