update
Browse files
app.py
CHANGED
|
@@ -48,7 +48,7 @@ def greet(
|
|
| 48 |
raise ValueError(f'ERROR: query contains more than two word {query}')
|
| 49 |
|
| 50 |
if i != '':
|
| 51 |
-
if len(i.split(','))
|
| 52 |
raise ValueError(f'ERROR: candidate {n + 1} contains single word {i.split(",")}')
|
| 53 |
if len(i.split(',')) > 2:
|
| 54 |
raise ValueError(f'ERROR: candidate {n + 1} contains more than two word {i.split(",")}')
|
|
@@ -69,18 +69,24 @@ def greet(
|
|
| 69 |
demo = gr.Interface(
|
| 70 |
fn=greet,
|
| 71 |
inputs=[
|
| 72 |
-
gr.Textbox(lines=1, placeholder="Query Word Pair (separate by comma
|
| 73 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 1 (separate by comma
|
| 74 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 2 (separate by comma
|
| 75 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 3 (separate by comma
|
| 76 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 4 (separate by comma
|
| 77 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 5 (separate by comma
|
| 78 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 6 (separate by comma
|
| 79 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 7 (separate by comma
|
| 80 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 8 (separate by comma
|
| 81 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 9 (separate by comma
|
| 82 |
-
gr.Textbox(lines=1, placeholder="Candidate Word Pair 10 (separate by comma
|
| 83 |
],
|
| 84 |
outputs="label",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
)
|
| 86 |
demo.launch(show_error=True)
|
|
|
|
|
|
|
|
|
| 48 |
raise ValueError(f'ERROR: query contains more than two word {query}')
|
| 49 |
|
| 50 |
if i != '':
|
| 51 |
+
if len(i.split(',')) == 1:
|
| 52 |
raise ValueError(f'ERROR: candidate {n + 1} contains single word {i.split(",")}')
|
| 53 |
if len(i.split(',')) > 2:
|
| 54 |
raise ValueError(f'ERROR: candidate {n + 1} contains more than two word {i.split(",")}')
|
|
|
|
| 69 |
demo = gr.Interface(
|
| 70 |
fn=greet,
|
| 71 |
inputs=[
|
| 72 |
+
gr.Textbox(lines=1, placeholder="Query Word Pair (separate by comma)"),
|
| 73 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 1 (separate by comma)"),
|
| 74 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 2 (separate by comma)"),
|
| 75 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 3 (separate by comma)"),
|
| 76 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 4 (separate by comma)"),
|
| 77 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 5 (separate by comma)"),
|
| 78 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 6 (separate by comma)"),
|
| 79 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 7 (separate by comma)"),
|
| 80 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 8 (separate by comma)"),
|
| 81 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 9 (separate by comma)"),
|
| 82 |
+
gr.Textbox(lines=1, placeholder="Candidate Word Pair 10 (separate by comma)")
|
| 83 |
],
|
| 84 |
outputs="label",
|
| 85 |
+
examples=[
|
| 86 |
+
["beauty,aesthete", "pleasure,hedonist", "emotion,demagogue", "opinion,sympathizer", "seance,medium", "luxury,ascetic"] + [''] * 5,
|
| 87 |
+
["classroom,desk", "bank,dollar", "church,pew", "studio,paintbrush", "museum,artifact"] + [''] * 6,
|
| 88 |
+
],
|
| 89 |
)
|
| 90 |
demo.launch(show_error=True)
|
| 91 |
+
|
| 92 |
+
|