File size: 442 Bytes
61245a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
from transformers import pipeline

st.title("Hugging Face Model Demo")


@st.cache(allow_output_mutation=True)
def load_model():
    return pipeline("text-generation", model="klyang/MentaLLaMA-chat-7B")


model = load_model()

user_input = st.text_input("Enter your text:")
if user_input:
    with st.spinner("Generating response..."):
        result = model(user_input)
        st.success(result[0]["generated_text"])