Spaces:
Sleeping
Sleeping
Download Agent_1.py from Darshika94/AgentBuilding: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/Darshika94/AgentBuilding/resolve/main/Agent_1.py
- Command line
-
hf download hf://spaces/Darshika94/AgentBuilding/Agent_1.py
-
curl -L -o Agent_1.py https://huggingface.co/spaces/Darshika94/AgentBuilding/resolve/main/Agent_1.py
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 | |
| 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? | |