Darshika94 commited on
Commit
b7cdf42
·
verified ·
1 Parent(s): c17ae29

Upload 2 files

Browse files
Files changed (2) hide show
  1. Agent_1.py +29 -0
  2. requirements.txt +3 -3
Agent_1.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ st.set_page_config(page_title="AI Chatbot", layout="centered")
5
+ st.title("🤖 Free AI Chatbot")
6
+
7
+ # Load the model once
8
+ @st.cache_resource
9
+ def load_model():
10
+ return pipeline("text2text-generation", model="google/flan-t5-base")
11
+
12
+ chatbot = load_model()
13
+
14
+ # Input box
15
+ user_input = st.text_input("You:", "")
16
+
17
+ # Response output
18
+ if user_input:
19
+ prompt = f"Answer this clearly and briefly: {user_input}"
20
+ response = chatbot(prompt, max_length=100, do_sample=False)[0]['generated_text']
21
+ st.markdown(f"**Bot:** {response}")
22
+
23
+
24
+ #streamlit run Agent_1.py
25
+
26
+ #what is computer engineering?
27
+ #what is machine learning?
28
+ #what is artifical intelligence?
29
+ #what is deep learning model?
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- altair
2
- pandas
3
- streamlit
 
1
+ transformers
2
+ torch
3
+ streamlit