RAG / app.py
ghuman7's picture
Update app.py
468924d verified
raw
history blame
940 Bytes
import streamlit as st
import requests
# Hugging Face API details
API_URL = "https://api-inference.huggingface.co/models/facebook/blenderbot-400M-distill"
headers = {"Authorization": f"Bearer {rag}"}
# Function to query the model
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
# Streamlit UI for Mental Health Chatbot
st.title("Mental Health Chatbot")
st.write("""
This chatbot provides responses to mental health-related queries.
Please note that this is an AI-based tool and is not a substitute for professional mental health support.
""")
# User input
user_input = st.text_input("How can I help you today?")
if st.button("Get Response"):
if user_input:
# Query the model
output = query({"inputs": user_input})
st.write(f"**Response:** {output['generated_text']}")
else:
st.write("Please enter a query to get a response.")