CareBot / app.py
sauvivek's picture
Create app.py
a351891 verified
import gradio as gr
from transformers import pipeline
# Load the two mental health chatbots (models)
# Model 1: PsychGPT
model1 = pipeline("text-generation", model="thrishala/mental_health_chatbot")
# Model 2: Mental Health Chatbot from Hugging Face (replace with the actual model you're using)
model2 = pipeline("text-generation", model="thrishala/mental_health_chatbot") # Update with actual model name
# Define a function that takes user input and gets responses from both models
def compare_models(input_text):
response1 = model1(input_text, max_length=100)[0]["generated_text"]
response2 = model2(input_text, max_length=100)[0]["generated_text"]
return response1, response2
# Create Gradio interface for comparison
iface = gr.Interface(fn=compare_models,
inputs="text",
outputs=["text", "text"],
live=True,
title="Mental Health Chatbot Comparison",
description="Compare responses from two different Mental Health Chatbot models")
# Launch the interface
iface.launch()