omar / app.py
not-lain's picture
Enable Space CI
005a47f verified
raw
history blame
543 Bytes
# now to create an interface with gradio
import gradio as gr
from transformers import pipeline
from gradio_space_ci import enable_space_ci
enable_space_ci()
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
# a function that uses the pipeline
# takes text as input and passes it to the pipeline
def chat(text):
output = pipe(text)[0]["generated_text"]
return output
# fucntion , input of type text , output of type text
demo = gr.Interface(chat , "text" , "text" )
demo.launch()