Spaces:
Paused
Paused
fix empty query
Browse files
app.py
CHANGED
@@ -180,14 +180,6 @@ if __name__ == "__main__":
|
|
180 |
css=".underline-on-hover:hover { text-decoration: underline; } .flagging { font-size:12px; color:Silver; }"
|
181 |
)
|
182 |
|
183 |
-
def submit(query, lang, k):
|
184 |
-
if query == "":
|
185 |
-
raise ValueError("Invalid query provided")
|
186 |
-
return {
|
187 |
-
results: scisearch(query, lang, k),
|
188 |
-
flagging_form: gr.update(visible=True),
|
189 |
-
}
|
190 |
-
|
191 |
with demo:
|
192 |
with gr.Row():
|
193 |
gr.Markdown(value=description)
|
@@ -235,6 +227,14 @@ if __name__ == "__main__":
|
|
235 |
flag_btn = gr.Button("Flag Results")
|
236 |
flag_btn.click(flag, inputs=[query, lang, k, flag_txt], outputs=[flag_txt])
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
query.submit(fn=submit, inputs=[query, lang, k], outputs=[results, flagging_form])
|
239 |
submit_btn.click(submit, inputs=[query, lang, k], outputs=[results, flagging_form])
|
240 |
|
|
|
180 |
css=".underline-on-hover:hover { text-decoration: underline; } .flagging { font-size:12px; color:Silver; }"
|
181 |
)
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
with demo:
|
184 |
with gr.Row():
|
185 |
gr.Markdown(value=description)
|
|
|
227 |
flag_btn = gr.Button("Flag Results")
|
228 |
flag_btn.click(flag, inputs=[query, lang, k, flag_txt], outputs=[flag_txt])
|
229 |
|
230 |
+
def submit(query, lang, k):
|
231 |
+
query = query.strip()
|
232 |
+
if query is None or query == "":
|
233 |
+
return "", ""
|
234 |
+
return {
|
235 |
+
results: scisearch(query, lang, k),
|
236 |
+
flagging_form: gr.update(visible=True),
|
237 |
+
}
|
238 |
query.submit(fn=submit, inputs=[query, lang, k], outputs=[results, flagging_form])
|
239 |
submit_btn.click(submit, inputs=[query, lang, k], outputs=[results, flagging_form])
|
240 |
|