CoolFace
Apppublic

0xrizzler/Text2Text

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py19 linesDownload Raw Back to root
1import streamlit as st2from transformers import pipeline3 4task = st.selectbox("Choose a task", ["Text generation", "Summarization"])5 6if task == "Text generation":7    model = pipeline("text-generation")8else:9    model = pipeline("summarization")10    11prompt = st.text_area("Enter a prompt")12 13if prompt:14    output = model(prompt)[0]["generated_text"]15    st.write(output)16 17'''This sets up a simple interface with a dropdown to select either text generation or summarization,18a text area for input, and displays the generated output'''19