Spaces:
Sleeping
Sleeping
Daniel Ecer commited on
Commit ·
bae2b34
1
Parent(s): e725501
Move catfact to separate module
Browse files
fngradio_various_api_mcp/apis/__init__.py
ADDED
|
File without changes
|
fngradio_various_api_mcp/apis/catfact.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fngradio import FnGradioApp
|
| 2 |
+
import httpx
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
app = FnGradioApp()
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@app.interface()
|
| 9 |
+
def catfact() -> str:
|
| 10 |
+
"""
|
| 11 |
+
Random cat fact from `catfact.ninja`
|
| 12 |
+
"""
|
| 13 |
+
response = httpx.get('https://catfact.ninja/fact')
|
| 14 |
+
response.raise_for_status()
|
| 15 |
+
return response.json()['fact']
|
fngradio_various_api_mcp/app.py
CHANGED
|
@@ -1,15 +1,10 @@
|
|
| 1 |
from fngradio import FnGradioApp
|
| 2 |
-
import httpx
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
app = FnGradioApp()
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
"""
|
| 11 |
-
Random cat fact from `catfact.ninja`
|
| 12 |
-
"""
|
| 13 |
-
response = httpx.get('https://catfact.ninja/fact')
|
| 14 |
-
response.raise_for_status()
|
| 15 |
-
return response.json()['fact']
|
|
|
|
| 1 |
from fngradio import FnGradioApp
|
|
|
|
| 2 |
|
| 3 |
+
from fngradio_various_api_mcp.apis import (
|
| 4 |
+
catfact
|
| 5 |
+
)
|
| 6 |
|
|
|
|
| 7 |
|
| 8 |
+
app = FnGradioApp(apps=[
|
| 9 |
+
catfact.app
|
| 10 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|