import gradio as gr import openai import os # Initialize the OpenAI API client with your actual API key class Classifier: def __init__(self): openai.api_key = os.getenv("OPENAI_API_KEY") def classify_text(self,text): # Specify the desired model and additional options response = openai.Completion.create( engine="text-davinci-003", prompt = f"""Your are Mental healthcare Assistant. Classify the following input message from the patient if the message related to Mental healtcare issue return 'True', Else not related return 'False': ```message from the patient: {text}``` """ , temperature=0, max_tokens=50, # We only need a single token as the classification result n=1, stop=None, ) # Extract and return the generated classification result generated_text = response.choices[0].text.strip() return generated_text def clear_func(self): return " "," " def gradio_interface(self): with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as demo: gr.HTML("""