Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import numpy as np | |
| from transformers import AutoModelForQuestionAnswering | |
| from transformers import pipeline | |
| from transformers import AutoTokenizer | |
| description = """ ### Demo ADHD QA Bot | |
| This demo is a fine-tuned version of distilbert-base-uncased, which has been trained on a ADHD dataset. | |
| The model can answer question with a context, one example could be: | |
| - Question = What is ADHD? | |
| - Context = Attention-deficit/hyperactivity disorder (ADHD) is a neurodevelopmental disorder characterized by inattention, hyperactivity, and impulsivity. | |
| """ | |
| # Initializing the pipeline for the question answering model | |
| question_answerer = pipeline("question-answering", model="Only-Mike/ADHD_Test_qa_model") | |
| def question_answer(question, context): | |
| # Answering from the trained model | |
| result = question_answerer(question=question, context=context) | |
| return result["answer"] | |
| gr.Interface(fn=question_answer, description = description, inputs=["text", "text"], outputs=["text"]).launch() | |