yousifalishah's picture
Update app.py
8ed339c verified
raw
history blame contribute delete
638 Bytes
import streamlit as st
from transformers import pipeline
# Load a text-generation model from Hugging Face (OPEN-ACCESS)
chatbot = pipeline("text-generation", model="HuggingFaceH4/zephyr-7b-alpha")
def chatbot_response(user_input):
response = chatbot(user_input, max_length=200, do_sample=True)
return response[0]["generated_text"]
# Streamlit UI
st.title("AI-Powered Chatbot πŸ€–")
st.write("Hello! I'm your chatbot. Ask me anything.")
user_input = st.text_input("You:", "")
if user_input:
bot_response = chatbot_response(user_input)
st.text_area("Chatbot:", value=bot_response, height=100, max_chars=None, key=None)