Commit
·
102d44d
1
Parent(s):
80f5e2a
Actualizar la configuración del servidor para usar variables de entorno y mejorar la flexibilidad de la aplicación
Browse files
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
from tools import letter_counter, prime_factors, roll_dice, coin_flip, create_shape
|
|
|
|
|
3 |
|
4 |
-
|
5 |
|
6 |
# === GRADIO INTERFACE ===
|
7 |
demo = gr.TabbedInterface(
|
@@ -32,4 +34,4 @@ demo = gr.TabbedInterface(
|
|
32 |
]
|
33 |
)
|
34 |
|
35 |
-
demo.launch(mcp_server=True,server_port=
|
|
|
1 |
import gradio as gr
|
2 |
from tools import letter_counter, prime_factors, roll_dice, coin_flip, create_shape
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
import os
|
5 |
|
6 |
+
load_dotenv()
|
7 |
|
8 |
# === GRADIO INTERFACE ===
|
9 |
demo = gr.TabbedInterface(
|
|
|
34 |
]
|
35 |
)
|
36 |
|
37 |
+
demo.launch(mcp_server=True,server_port=int(os.getenv("GRADIO_PORT", 7860)))
|
tools.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import requests as request
|
|
|
2 |
|
3 |
# === TOOLS ===
|
4 |
def letter_counter(word, letter):
|
@@ -91,8 +92,7 @@ def execute_action(tab_id, action, params):
|
|
91 |
"action": action,
|
92 |
"args": params
|
93 |
}
|
94 |
-
url = f"
|
95 |
-
print(url)
|
96 |
|
97 |
response = request.post(
|
98 |
url,
|
|
|
1 |
import requests as request
|
2 |
+
import os
|
3 |
|
4 |
# === TOOLS ===
|
5 |
def letter_counter(word, letter):
|
|
|
92 |
"action": action,
|
93 |
"args": params
|
94 |
}
|
95 |
+
url = f"{os.getenv('FRONTEND_SERVER')}/execute/{tab_id}"
|
|
|
96 |
|
97 |
response = request.post(
|
98 |
url,
|