Spaces:
Runtime error
Runtime error
| from transformers import pipeline | |
| # Define the prompt for self-assessment | |
| prompt = "Please answer the following questions to assess your ADHD symptoms:\n" | |
| # Define the questions for self-assessment | |
| questions = [ | |
| "Do you often struggle with paying attention to details or making careless mistakes in your work or daily activities?", | |
| "Do you find it difficult to sustain focus on tasks or activities, especially if they are not highly stimulating or interesting to you?", | |
| "Are you frequently forgetful in your daily life, such as forgetting appointments, deadlines, or where you put your belongings?", | |
| "Do you often have trouble organizing tasks and activities, such as prioritizing tasks or managing your time effectively?", | |
| "Do you frequently feel restless or have difficulty staying seated in situations where it is expected, such as in meetings or during conversations?", | |
| "Are you easily distracted by external stimuli or unrelated thoughts during conversations, work, or leisure activities?", | |
| "Do you often struggle with following through on instructions or completing tasks, even when they are important or meaningful to you?", | |
| "Do you frequently lose or misplace important items, such as keys, wallets, or phones?", | |
| "Do you find it challenging to engage in activities that require sustained mental effort or attention, such as reading or studying?", | |
| "Do you often feel overwhelmed or have difficulty managing multiple tasks or responsibilities at the same time?" | |
| ] | |
| # Initialize the Hugging Face pipeline for text generation | |
| generator = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B") | |
| # Generate the self-assessment | |
| assessment = generator(prompt + "\n".join(questions), max_length=500, num_return_sequences=1, do_sample=True)[0]['generated_text'] | |
| # Print the self-assessment | |
| print(assessment) |