File size: 726 Bytes
10d53e4
 
 
 
 
 
2dc124c
3e9899e
10d53e4
 
 
 
 
 
 
 
 
 
c17cd7b
 
2baa1da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import gradio as gr
from transformers import pipeline


def blog_gen(txt):
    generator=pipeline(task='text-generation',model='shivanshu292001/GeneratorModel')
    gen_blog=generator(txt,max_length=2000)
    remove_gen_text = list(map(lambda x: x["generated_text"], gen_blog))
    clean_text = list(map(lambda x: x.replace("\n\n", " "), remove_gen_text))
    return clean_text


iface = gr.Interface(fn=blog_gen,
                     inputs=[
                         gr.inputs.Textbox(
                             lines=2, placeholder=None, label='Sentence'),
                     ],
                     outputs=[gr.outputs.JSON(label=None)],
                    css="footer {visibility: hidden}")
iface.launch()