File size: 1,096 Bytes
a351891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()