Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -196,12 +196,14 @@ def gradio_interface(search_str, selected_names, user_query):
|
|
| 196 |
models = search_models(search_str)
|
| 197 |
|
| 198 |
if not models:
|
| 199 |
-
return "No models found for the given search query.", None
|
|
|
|
|
|
|
| 200 |
|
| 201 |
selected_model_ids = [model_id for model_id, model_data in models.items() if model_data['name'] in selected_names]
|
| 202 |
|
| 203 |
if not selected_model_ids:
|
| 204 |
-
return "No models selected for analysis.", None
|
| 205 |
|
| 206 |
all_final_items = []
|
| 207 |
for model_id in selected_model_ids:
|
|
@@ -215,7 +217,7 @@ def gradio_interface(search_str, selected_names, user_query):
|
|
| 215 |
|
| 216 |
final_items = split_biomodels(antimony_file_path)
|
| 217 |
if not final_items:
|
| 218 |
-
return "No content found in the biomodel.", None
|
| 219 |
|
| 220 |
all_final_items.extend(final_items)
|
| 221 |
|
|
@@ -224,9 +226,9 @@ def gradio_interface(search_str, selected_names, user_query):
|
|
| 224 |
|
| 225 |
if db:
|
| 226 |
response = generate_response(db, user_query, "")
|
| 227 |
-
return "Models have been processed and added to the database.", response
|
| 228 |
|
| 229 |
-
return "Database creation failed.", None
|
| 230 |
|
| 231 |
def main():
|
| 232 |
gr.Interface(
|
|
@@ -238,10 +240,12 @@ def main():
|
|
| 238 |
],
|
| 239 |
outputs=[
|
| 240 |
gr.Textbox(label="Status"),
|
|
|
|
| 241 |
gr.Textbox(label="Response")
|
| 242 |
],
|
| 243 |
live=True
|
| 244 |
-
).launch()
|
| 245 |
|
| 246 |
if __name__ == "__main__":
|
| 247 |
main()
|
|
|
|
|
|
| 196 |
models = search_models(search_str)
|
| 197 |
|
| 198 |
if not models:
|
| 199 |
+
return "No models found for the given search query.", [], None
|
| 200 |
+
|
| 201 |
+
model_names = [model_data['name'] for model_id, model_data in models.items()]
|
| 202 |
|
| 203 |
selected_model_ids = [model_id for model_id, model_data in models.items() if model_data['name'] in selected_names]
|
| 204 |
|
| 205 |
if not selected_model_ids:
|
| 206 |
+
return "No models selected for analysis.", model_names, None
|
| 207 |
|
| 208 |
all_final_items = []
|
| 209 |
for model_id in selected_model_ids:
|
|
|
|
| 217 |
|
| 218 |
final_items = split_biomodels(antimony_file_path)
|
| 219 |
if not final_items:
|
| 220 |
+
return "No content found in the biomodel.", model_names, None
|
| 221 |
|
| 222 |
all_final_items.extend(final_items)
|
| 223 |
|
|
|
|
| 226 |
|
| 227 |
if db:
|
| 228 |
response = generate_response(db, user_query, "")
|
| 229 |
+
return "Models have been processed and added to the database.", model_names, response
|
| 230 |
|
| 231 |
+
return "Database creation failed.", model_names, None
|
| 232 |
|
| 233 |
def main():
|
| 234 |
gr.Interface(
|
|
|
|
| 240 |
],
|
| 241 |
outputs=[
|
| 242 |
gr.Textbox(label="Status"),
|
| 243 |
+
gr.CheckboxGroup(label="Select biomodels", choices=[]),
|
| 244 |
gr.Textbox(label="Response")
|
| 245 |
],
|
| 246 |
live=True
|
| 247 |
+
).launch(share=True)
|
| 248 |
|
| 249 |
if __name__ == "__main__":
|
| 250 |
main()
|
| 251 |
+
|