Commit
·
a3b7f25
1
Parent(s):
b03ffe7
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
gr.Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from streamlit import *
|
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 |
+
iface = gr.Interface(
|
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 |
+
)
|