Spaces:
Sleeping
Sleeping
File size: 854 Bytes
6bdcff3 bd29bf9 6bdcff3 bd29bf9 be228d0 bd29bf9 8deb42a bd29bf9 907f7e1 bd29bf9 852aad8 bd29bf9 852aad8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import streamlit as st
from transformers import pipeline
# Initialize the pipeline
st.title("Hugging Face Text Generation Қазақша")
st.subheader("Model: ai-forever/mGPT-1.3B-kazakh")
# Create the pipeline
@st.cache_resource
def load_pipeline():
return pipeline("text-generation", model="ai-forever/mGPT-1.3B-kazakh")
pipe = load_pipeline()
# User input
prompt = st.text_area("Мәтін енгізіңіз:", value="", height=100)
# Text generation
if st.button("Мәтін жасалуда"):
if prompt.strip():
with st.spinner("Мәтін жасалуда"):
result = pipe(prompt, max_length=100, num_return_sequences=1)
st.subheader("Generated Text:")
st.write(result[0]["generated_text"])
else:
st.error("Мәтін еңгізу үшін батырманы басыңыз")
|