Commit
•
6b2f53f
1
Parent(s):
b3ac2eb
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,3 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
-
# Load the desired model using Hugging Face's model hub
|
4 |
-
model = pipeline(model="philschmid/bart-large-cnn-samsum")
|
5 |
-
def generate_text(input_text):
|
6 |
-
# Set the maximum response size to 100 characters
|
7 |
-
output = model(input_text, max_length=100, do_sample=True)
|
8 |
-
# Access the generated response
|
9 |
-
response = output[0]['summarized_text']
|
10 |
-
return response
|
11 |
|
12 |
-
|
13 |
-
fn=generate_text,
|
14 |
-
inputs=gr.inputs.Textbox("Input Text"),
|
15 |
-
outputs="text",
|
16 |
-
title="Text Generation App",
|
17 |
-
description="Enter an input text and get a generated response (limited to 100 characters)."
|
18 |
-
)
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
gr.Interface.load("models/philschmid/bart-large-cnn-samsum").launch()
|
|
|
|
|
|
|
|
|
|
|
|