BillBojangeles2000 commited on
Commit
a3b7f25
·
1 Parent(s): b03ffe7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -1,3 +1,18 @@
1
- import gradio as gr
 
 
 
 
 
 
 
 
 
2
 
3
- gr.Interface.load("models/philschmid/bart-large-cnn-samsum", max_length=100)).launch()
 
 
 
 
 
 
 
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
+ )