Spaces:
Sleeping
Sleeping
File size: 734 Bytes
b7cdf42 | 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 28 29 30 | import streamlit as st
from transformers import pipeline
st.set_page_config(page_title="AI Chatbot", layout="centered")
st.title("🤖 Free AI Chatbot")
# Load the model once
@st.cache_resource
def load_model():
return pipeline("text2text-generation", model="google/flan-t5-base")
chatbot = load_model()
# Input box
user_input = st.text_input("You:", "")
# Response output
if user_input:
prompt = f"Answer this clearly and briefly: {user_input}"
response = chatbot(prompt, max_length=100, do_sample=False)[0]['generated_text']
st.markdown(f"**Bot:** {response}")
#streamlit run Agent_1.py
#what is computer engineering?
#what is machine learning?
#what is artifical intelligence?
#what is deep learning model?
|