sob111 commited on
Commit
7034341
·
verified ·
1 Parent(s): 5813ded

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
 
3
  def saludo(nombre: str) -> str:
@@ -10,8 +11,11 @@ with gr.Blocks() as demo:
10
  boton = gr.Button("Saludar")
11
  boton.click(fn=saludo, inputs=nombre, outputs=salida)
12
 
13
- # 👇 importante: sin server_name ni server_port en Spaces
14
- demo.launch(show_api=True)
 
 
 
15
 
16
 
17
  #import os
 
1
+ import os
2
  import gradio as gr
3
 
4
  def saludo(nombre: str) -> str:
 
11
  boton = gr.Button("Saludar")
12
  boton.click(fn=saludo, inputs=nombre, outputs=salida)
13
 
14
+ # Hugging Face Spaces espera puerto 8080, accesible en 0.0.0.0
15
+ if __name__ == "__main__":
16
+ port = int(os.environ.get("PORT", 7860)) # PORT lo pone el runtime si existe
17
+ demo.launch(server_name="0.0.0.0", server_port=port, show_api=True)
18
+
19
 
20
 
21
  #import os