AgentBuilding / Agent_1.py
Darshika94's picture
Upload 2 files
b7cdf42 verified
raw
history blame contribute delete
734 Bytes
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?