Spaces:
Runtime error
Runtime error
File size: 1,015 Bytes
19eac8f 1e450e9 b61780a 9b676e0 b61780a 1e450e9 67391dd 200d959 b61780a 200d959 c0b0878 200d959 7f6d0a2 64d7d87 |
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 28 29 30 |
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()
|