Only-Mike commited on
Commit
b61780a
·
1 Parent(s): c0b0878

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -4,7 +4,12 @@ import numpy as np
4
  from transformers import AutoModelForQuestionAnswering
5
  from transformers import pipeline
6
  from transformers import AutoTokenizer
7
- from spaces_info import description
 
 
 
 
 
8
 
9
  # Initializing the pipeline for the question answering model
10
  question_answerer = pipeline("question-answering", model="Only-Mike/ADHD_Test_qa_model")
@@ -13,14 +18,10 @@ def question_answer(question, context):
13
  # Answering from the trained model
14
  result = question_answerer(question=question, context=context)
15
  return result["answer"]
 
 
 
16
 
17
- if __name__ == "__main__":
18
- demo = gr.Blocks()
19
- with demo:
20
- with gr.Row():
21
- gr.Markdown(value=description)
22
- gr.Interface(fn=question_answer, inputs=["text", "text"], outputs=["text"]).launch()
23
- demo.launch()
24
 
25
 
26
 
 
4
  from transformers import AutoModelForQuestionAnswering
5
  from transformers import pipeline
6
  from transformers import AutoTokenizer
7
+
8
+ description = """ ### Demo ADHD QA Bot
9
+ Example:
10
+ - Question = What is ADHD?
11
+ - Context = Attention-deficit/hyperactivity disorder (ADHD) is a neurodevelopmental disorder characterized by inattention, hyperactivity, and impulsivity.
12
+ """
13
 
14
  # Initializing the pipeline for the question answering model
15
  question_answerer = pipeline("question-answering", model="Only-Mike/ADHD_Test_qa_model")
 
18
  # Answering from the trained model
19
  result = question_answerer(question=question, context=context)
20
  return result["answer"]
21
+
22
+ gr.Interface(fn=question_answer, description = description, inputs=["text", "text"], outputs=["text"]).launch()
23
+
24
 
 
 
 
 
 
 
 
25
 
26
 
27