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