File size: 434 Bytes
246cae1
 
 
 
 
bb36174
246cae1
 
 
bb36174
921e772
246cae1
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import streamlit as st
import transformers
from transformers import pipeline

st.title("Text Generation with Hugging Face")
 

model_name = "bigscience/mt0-xxl-mt"
generator = pipeline("text-generation", model=model_name, device=0)
prompt = st.text_input("Enter text prompt:", "Once upon a time")


if st.button("Generate Text"):
    output = generator(prompt, max_length=100, do_sample=True)
    st.write(output[0]['generated_text'])