Bahareh Kavousi nejad commited on
Commit
a1e73e9
·
1 Parent(s): d6f1e5a

From the beginning :_)

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -1,18 +1,13 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- # Load your LLM
5
- chatbot = pipeline("text-generation", model="gpt2")
6
 
7
- # Streamlit app interface
8
- st.title("Chat with LLM")
9
-
10
- user_input = st.text_input("You: ", placeholder="Type your message here...")
11
 
12
  if st.button("Send"):
13
- if user_input.strip():
14
- with st.spinner("Generating response..."):
15
- response = chatbot(user_input, max_length=100, num_return_sequences=1)
16
- st.text_area("AI:", value=response[0]["generated_text"], height=200, max_chars=None)
17
- else:
18
- st.warning("Please enter a valid input.")
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load the model
5
+ chatbot = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B")
6
 
7
+ # Streamlit app
8
+ st.title("Chat with an LLM")
9
+ user_input = st.text_input("Your Message:")
 
10
 
11
  if st.button("Send"):
12
+ response = chatbot(user_input, max_length=100, do_sample=True)
13
+ st.text_area("LLM Response:", response[0]["generated_text"], height=200)