Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,37 +1,37 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
context = "
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
context =
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 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()
|
|
|
|
|
|
|
|
|