File size: 839 Bytes
dbd0a3c
f159a3c
dbd0a3c
848db2f
 
 
 
 
 
 
619f3f9
f159a3c
 
06ec86b
848db2f
f159a3c
619f3f9
b6e9288
848db2f
f159a3c
40c942f
848db2f
 
 
 
 
f159a3c
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

# Load the conversational model
@st.cache_resource
def load_model():
    return pipeline("conversational", model="facebook/blenderbot-400M-distill")

# Initialize the model
generator = load_model()

st.title("Donald Trump Style Text Generator")
st.write("Enter a prompt, and the model will respond in a manner inspired by Donald Trump.")

# Input from the user
user_input = st.text_input("Enter your prompt:")

if user_input:
    # Prefix to encourage Trump-inspired responses
    trump_prompt = f"In the style of Donald Trump: {user_input}"
    
    # Generate the conversational response
    conversation = generator(trump_prompt)
    
    # Extract and display the generated text
    generated_text = conversation.generated_responses[0]
    st.write("Response:", generated_text)