awacke1 commited on
Commit
f125ab8
β€’
1 Parent(s): ddbb6da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -31
app.py CHANGED
@@ -1,37 +1,37 @@
1
  import gradio as gr
 
2
 
3
- context = "What should be documented in a care plan?\n"
4
- context = context + "Regardless of what your preferences are, your care plan should include:\n"
5
- context = context + "What your assessed care needs are.\n"
6
- context = context + "What type of support you should receive.\n"
7
- context = context + "Your desired outcomes.\n"
8
- context = context + "Who should provide care.\n"
9
- context = context + "When care and support should be provided.\n"
10
- context = context + "Records of care provided.\n"
11
- context = context + "Your wishes and personal preferences.\n"
12
- context = context + "The costs of the services.\n"
 
 
 
 
13
 
14
- context = context + "Dimensions\n"
15
- context = context + "1-Ontology of Plan\n"
16
- context = context + "2-Problems as evidenced by Signs of Systems\n"
17
- context = context + "3-Assessment of Needs\n"
18
- context = context + "4-Questions about problems faced\n"
19
- context = context + "5-Goals for long and short term improvements\n"
20
- context = context + "6-Knowledge-Behavior-Status Quality Measures\n"
21
- context = context + "7-Intervention List of Options\n"
22
- context = context + "8-Quality Measures\n"
23
- context = context + "9-Pathways Available\n"
24
 
25
- with open('WritingCarePlans.txt', 'r') as file:
26
- context = file.read()
27
 
28
- question = "What should be documented in a care plan?"
 
 
 
 
 
 
 
 
29
 
30
- gr.Interface.load(
31
- "huggingface/deepset/roberta-base-squad2",
32
- theme="default",
33
- css=".footer{display:none !important}",
34
- inputs=[gr.inputs.Textbox(lines=40, default=context, label="Context paragraph"), gr.inputs.Textbox(lines=10, default=question, label="Question")],
35
- outputs=[gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Score")],
36
- title=None,
37
- description="Provide your own paragraph and ask any question about the text. How well does the model answer?").launch()
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ context = ""
5
+ def SetContext(textfile):
6
+ with open(textfile, 'r') as file:
7
+ context = file.read()
8
+ SetContext('WritingCarePlans.txt')
9
+ question = "What should be documented in a care plan?"
10
+ title = "Transformers - Sentence to Paragraph - For Mindfulness"
11
+ examples = [
12
+ ["Break the cycle of stress and anxiety"],
13
+ ["Feel calm in stressful situations"],
14
+ ["Deal with work pressure"],
15
+ ["Learn to reduce feelings of overwhelmed"]
16
+ ]
17
+ model1 = gr.Interface.load("huggingface/deepset/roberta-base-squad2")
18
 
19
+ def f1(x):
20
+ return model1(x)
 
 
 
 
 
 
 
 
21
 
 
 
22
 
23
+ demo = gr.Blocks()
24
+ with demo:
25
+ inputs1=[gr.inputs.Textbox(lines=40, default=context, label="Context paragraph"),gr.inputs.Textbox(lines=10, default=question, label="Question")]
26
+ out1=gr.Textbox()
27
+ b1 = gr.Button("roberta")
28
+ """
29
+ # Enter a new context paragraph or new question to ask questions about the context content
30
+ """)
31
+ inp = gr.Textbox(placeholder="What is a care plan for?")
32
 
33
+ inp.change(fn=f1,
34
+ inputs=inputs1,
35
+ outputs=out1)
36
+
37
+ demo.launch()