Jonas commited on
Commit
d8e24c3
Β·
1 Parent(s): 4998d8e

Update dependencies, refactor imports, and add plotting functionality

Browse files
README.md CHANGED
@@ -4,7 +4,6 @@ emoji: πŸ’Š
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
- app_file: src/app.py
8
  tag: 'mcp-server-track'
9
  short_description: 'Gradio app that exposes a drug-event tool as an MCP server.'
10
  ---
@@ -34,7 +33,7 @@ To use this application as a tool with an MCP client (like Cursor or Claude Desk
34
 
35
  1. **Run the App**:
36
  ```bash
37
- python src/app.py
38
  ```
39
  2. **Find the MCP URL**: The server will start and print the MCP URL in the console. It will look something like this:
40
  `http://127.0.0.1:7860/gradio_api/mcp/sse`
 
4
  colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
 
7
  tag: 'mcp-server-track'
8
  short_description: 'Gradio app that exposes a drug-event tool as an MCP server.'
9
  ---
 
33
 
34
  1. **Run the App**:
35
  ```bash
36
+ python app.py
37
  ```
38
  2. **Find the MCP URL**: The server will start and print the MCP URL in the console. It will look something like this:
39
  `http://127.0.0.1:7860/gradio_api/mcp/sse`
src/app.py β†’ app.py RENAMED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
- from src.openfda_client import get_top_adverse_events, get_drug_event_pair_frequency
3
- from src.plotting import create_bar_chart
4
  import pandas as pd
5
 
6
  # --- Formatting Functions ---
 
1
  import gradio as gr
2
+ from openfda_client import get_top_adverse_events, get_drug_event_pair_frequency
3
+ from plotting import create_bar_chart
4
  import pandas as pd
5
 
6
  # --- Formatting Functions ---
src/openfda_client.py β†’ openfda_client.py RENAMED
@@ -100,4 +100,4 @@ def get_drug_event_pair_frequency(drug_name: str, event_name: str) -> dict:
100
  except requests.exceptions.RequestException as req_err:
101
  return {"error": f"A network request error occurred: {req_err}"}
102
  except Exception as e:
103
- return {"error": f"An unexpected error occurred: {e}"}
 
100
  except requests.exceptions.RequestException as req_err:
101
  return {"error": f"A network request error occurred: {req_err}"}
102
  except Exception as e:
103
+ return {"error": f"An unexpected error occurred: {e}"}
src/plotting.py β†’ plotting.py RENAMED
File without changes
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
- gradio[mcp]>=5.0
2
  pandas
3
  requests
4
  plotly
5
  cachetools
6
- pytest
 
1
+ gradio[mcp]>=5.3
2
  pandas
3
  requests
4
  plotly
5
  cachetools
6
+ pytest
src/__init__.py DELETED
File without changes
src/main.py DELETED
File without changes
tests/test_openfda_client.py CHANGED
@@ -1,7 +1,7 @@
1
  import pytest
2
  from unittest.mock import patch, MagicMock
3
  import requests
4
- from src.openfda_client import get_top_adverse_events, get_drug_event_pair_frequency, cache
5
 
6
  @pytest.fixture(autouse=True)
7
  def clear_cache():
 
1
  import pytest
2
  from unittest.mock import patch, MagicMock
3
  import requests
4
+ from openfda_client import get_top_adverse_events, get_drug_event_pair_frequency, cache
5
 
6
  @pytest.fixture(autouse=True)
7
  def clear_cache():