laptop_guru / app.py
tdnathmlenthusiast's picture
actual code deployed
715b816
raw
history blame
No virus
1.03 kB
# 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)