Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1126,37 +1126,16 @@ async def main():
|
|
| 1126 |
# Cria e lança interface
|
| 1127 |
demo = create_interface()
|
| 1128 |
|
| 1129 |
-
#
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
if GRADIO_SHARE:
|
| 1140 |
-
logging.info("🌐 Configurando link público do Gradio...")
|
| 1141 |
-
|
| 1142 |
-
demo.launch(
|
| 1143 |
-
server_name=server_name,
|
| 1144 |
-
server_port=port if port != 0 else None,
|
| 1145 |
-
share=GRADIO_SHARE,
|
| 1146 |
-
show_error=True,
|
| 1147 |
-
quiet=False
|
| 1148 |
-
)
|
| 1149 |
-
break # Se chegou aqui, deu certo
|
| 1150 |
-
except OSError as e:
|
| 1151 |
-
if "Cannot find empty port" in str(e) and port != ports_to_try[-1]:
|
| 1152 |
-
logging.warning(f"Porta {port} ocupada, tentando próxima...")
|
| 1153 |
-
continue
|
| 1154 |
-
else:
|
| 1155 |
-
logging.error(f"Erro ao iniciar servidor: {e}")
|
| 1156 |
-
raise
|
| 1157 |
-
except Exception as e:
|
| 1158 |
-
logging.error(f"Erro inesperado ao iniciar interface: {e}")
|
| 1159 |
-
raise
|
| 1160 |
|
| 1161 |
if __name__ == "__main__":
|
| 1162 |
run_async(main())
|
|
|
|
| 1126 |
# Cria e lança interface
|
| 1127 |
demo = create_interface()
|
| 1128 |
|
| 1129 |
+
# Configuração otimizada para Hugging Face Spaces
|
| 1130 |
+
logging.info("🤗 Iniciando interface para Hugging Face Spaces")
|
| 1131 |
+
demo.launch(
|
| 1132 |
+
server_name="0.0.0.0",
|
| 1133 |
+
server_port=7860,
|
| 1134 |
+
share=False,
|
| 1135 |
+
show_error=True,
|
| 1136 |
+
quiet=False,
|
| 1137 |
+
inbrowser=False
|
| 1138 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1139 |
|
| 1140 |
if __name__ == "__main__":
|
| 1141 |
run_async(main())
|