Spaces:
Paused
Paused
Commit
·
8521de0
1
Parent(s):
bcdb8fb
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,24 +24,23 @@ def question_answer(context, question):
|
|
| 24 |
return prediction
|
| 25 |
|
| 26 |
def split(text):
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
# act = True
|
| 34 |
-
|
| 35 |
-
# if act == False:
|
| 36 |
-
# context += w + ' '
|
| 37 |
-
# else:
|
| 38 |
-
# if w == '///':
|
| 39 |
-
# w = ''
|
| 40 |
-
# question += w + ' '
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
# def greet(texts):
|
| 47 |
# context, question = split(texts)
|
|
@@ -50,7 +49,7 @@ def split(text):
|
|
| 50 |
def greet(text):
|
| 51 |
context, question = split(text)
|
| 52 |
# answer = question_answer(context, question)
|
| 53 |
-
return
|
| 54 |
|
| 55 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 56 |
iface.launch()
|
|
|
|
| 24 |
return prediction
|
| 25 |
|
| 26 |
def split(text):
|
| 27 |
+
context, question = '', ''
|
| 28 |
+
act = False
|
| 29 |
+
tmp = ''
|
| 30 |
+
for t in text:
|
| 31 |
+
tmp += t
|
| 32 |
+
if len(tmp) == 4:
|
| 33 |
+
tmp = tmp[1:]
|
| 34 |
+
if tmp == '///':
|
| 35 |
+
act = True
|
| 36 |
|
| 37 |
+
if act == True:
|
| 38 |
+
question += t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
if act == False:
|
| 41 |
+
context += t
|
| 42 |
+
|
| 43 |
+
return context[:-2], question[1:]
|
| 44 |
|
| 45 |
# def greet(texts):
|
| 46 |
# context, question = split(texts)
|
|
|
|
| 49 |
def greet(text):
|
| 50 |
context, question = split(text)
|
| 51 |
# answer = question_answer(context, question)
|
| 52 |
+
return question
|
| 53 |
|
| 54 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 55 |
iface.launch()
|