File size: 657 Bytes
a3b7f25
3d4a15b
a3b7f25
 
 
 
 
 
 
 
0e618d1
a3b7f25
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from transformers import pipeline
import gradio as gr
# Load the desired model using Hugging Face's model hub
model = pipeline(model="philschmid/bart-large-cnn-samsum")
def generate_text(input_text):
    # Set the maximum response size to 100 characters
    output = model(input_text, max_length=100, do_sample=True)
    # Access the generated response
    response = output[0]['summarized_text']
    return response

iface = gr.Interface(
    fn=generate_text,
    inputs=gr.inputs.Textbox("Input Text"),
    outputs="text",
    title="Text Generation App",
    description="Enter an input text and get a generated response (limited to 100 characters)."
)