Spaces:
No application file
No application file
update gradio interface
Browse files
main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from smolagents import CodeAgent, LiteLLMModel
|
| 2 |
from smolagents.tools import ToolCollection
|
| 3 |
import gradio as gr
|
| 4 |
-
|
| 5 |
def chat_with_agent(message, history):
|
| 6 |
"""Initialize MCP client for each request to avoid connection issues"""
|
| 7 |
try:
|
|
@@ -34,13 +34,40 @@ def chat_with_agent(message, history):
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"❌ Error: {e}\nType: {type(e).__name__}"
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
if __name__ == "__main__":
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from smolagents import CodeAgent, LiteLLMModel
|
| 2 |
from smolagents.tools import ToolCollection
|
| 3 |
import gradio as gr
|
| 4 |
+
import requests
|
| 5 |
def chat_with_agent(message, history):
|
| 6 |
"""Initialize MCP client for each request to avoid connection issues"""
|
| 7 |
try:
|
|
|
|
| 34 |
except Exception as e:
|
| 35 |
return f"❌ Error: {e}\nType: {type(e).__name__}"
|
| 36 |
|
| 37 |
+
# TODO: placeholder function
|
| 38 |
+
def fetch_meta_yml(module_name):
|
| 39 |
+
# Adjust the URL or path to your actual source of nf-core modules
|
| 40 |
+
base_url = f"https://raw.githubusercontent.com/nf-core/modules/refs/heads/master/modules/nf-core/{module_name}/meta.yml"
|
| 41 |
+
try:
|
| 42 |
+
response = requests.get(base_url)
|
| 43 |
+
response.raise_for_status()
|
| 44 |
+
content = response.text
|
| 45 |
+
|
| 46 |
+
# Save for download
|
| 47 |
+
with open("meta.yml", "w") as f:
|
| 48 |
+
f.write(content)
|
| 49 |
+
|
| 50 |
+
return content, "meta.yml"
|
| 51 |
+
except Exception as e:
|
| 52 |
+
return f"Error: Could not retrieve meta.yml for module '{module_name}'\n{e}", None
|
| 53 |
+
|
| 54 |
if __name__ == "__main__":
|
| 55 |
+
with gr.Blocks() as demo:
|
| 56 |
+
gr.Markdown("### 🔍 Update an nf-core module `meta.yml` file by adding EDAM ontology terms.")
|
| 57 |
+
|
| 58 |
+
with gr.Row():
|
| 59 |
+
module_input = gr.Textbox(label="nf-core Module Name", placeholder="e.g. fastqc")
|
| 60 |
+
|
| 61 |
+
fetch_btn = gr.Button("Update meta.yml")
|
| 62 |
+
|
| 63 |
+
with gr.Row():
|
| 64 |
+
meta_output = gr.Textbox(label="meta.yml content", lines=20)
|
| 65 |
+
download_button = gr.File(label="Download meta.yml")
|
| 66 |
+
|
| 67 |
+
fetch_btn.click(
|
| 68 |
+
fn=fetch_meta_yml, # TODO: change to final function
|
| 69 |
+
inputs=module_input,
|
| 70 |
+
outputs=[meta_output, download_button]
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
demo.launch()
|